Removed the trivial peekc() and put the code at the appropriate places.
authormarkus schnalke <meillo@marmaro.de>
Thu, 22 Mar 2012 21:51:28 +0000 (22:51 +0100)
committermarkus schnalke <meillo@marmaro.de>
Thu, 22 Mar 2012 21:51:28 +0000 (22:51 +0100)
h/prototypes.h
sbr/Makefile.in
sbr/peekc.c [deleted file]
uip/burst.c

index 7c105f6..61e2c49 100644 (file)
@@ -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);
index 58f8293..d3782ff 100644 (file)
@@ -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 (file)
index 7d5f7f9..0000000
+++ /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 <h/mh.h>
-
-
-int
-peekc(FILE *fp)
-{
-       register int c;
-
-       c = getc(fp);
-       ungetc(c, fp);
-       return c;
-}
index 725abec..fdc78f4 100644 (file)
@@ -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);
                }