From: markus schnalke Date: Thu, 22 Mar 2012 21:51:28 +0000 (+0100) Subject: Removed the trivial peekc() and put the code at the appropriate places. X-Git-Tag: mmh-thesis-end~223 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=8e98a317c86f10e0c7e866c069e143bf48cf9814;p=mmh Removed the trivial peekc() and put the code at the appropriate places. --- diff --git a/h/prototypes.h b/h/prototypes.h index 7c105f6..61e2c49 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -80,7 +80,6 @@ int makedir(char *); char *nmh_getpass(const char *); char *norm_charmap(char *); char *new_fs(char *, char *); -int peekc(FILE *ib); int pidwait(pid_t, int); int pidstatus(int, FILE *, char *); void print_help(char *, struct swit *, int); diff --git a/sbr/Makefile.in b/sbr/Makefile.in index 58f8293..d3782ff 100644 --- a/sbr/Makefile.in +++ b/sbr/Makefile.in @@ -60,7 +60,7 @@ SRCS = addrsbr.c ambigsw.c atooi.c brkstring.c \ m_convert.c m_draft.c m_getfld.c m_gmprot.c \ m_name.c \ makedir.c mts.c norm_charmap.c \ - path.c peekc.c pidwait.c pidstatus.c \ + path.c pidwait.c pidstatus.c \ print_help.c print_sw.c print_version.c \ putenv.c refile.c mhbasename.c \ readconfig.c ruserpass.c seq_add.c seq_bits.c \ diff --git a/sbr/peekc.c b/sbr/peekc.c deleted file mode 100644 index 7d5f7f9..0000000 --- a/sbr/peekc.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -** peekc.c -- peek at the next character in a stream -** -** This code is Copyright (c) 2002, by the authors of nmh. See the -** COPYRIGHT file in the root directory of the nmh distribution for -** complete copyright information. -*/ - -#include - - -int -peekc(FILE *fp) -{ - register int c; - - c = getc(fp); - ungetc(c, fp); - return c; -} diff --git a/uip/burst.c b/uip/burst.c index 725abec..fdc78f4 100644 --- a/uip/burst.c +++ b/uip/burst.c @@ -216,11 +216,13 @@ find_delim(int msgnum, struct smsg *smsgs) for (c = 0; fgets(buffer, sizeof(buffer), in); c = buffer[0]) { if (strncmp(buffer, delim3, ld3) == 0 - && (msgp == 1 || c == '\n') - && ((cc = peekc(in)) == '\n' || - cc == EOF)) - break; - else + && (msgp == 1 || c == '\n')) { + cc = getc(in); + ungetc(cc, in); + if (cc == '\n' || cc == EOF) { + break; + } + } else pos += (long) strlen(buffer); }