Move #include from h/mh.h to source files
[mmh] / sbr / m_getfld.c
index c7f4279..a3852fe 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <h/mh.h>
 #include <h/utils.h>
+#include <ctype.h>
 
 /*
 ** This module has a long and checkered history.
@@ -423,8 +424,8 @@ m_getfld(int state, unsigned char *name, unsigned char *buf,
                        *cp++ = j = *(iob->_ptr + c);
                        c = _filbuf(iob);
 #endif
-                       if (c == EOF ||
-                         ((j == '\0' || j == '\n') && c != ' ' && c != '\t')) {
+                       if (c == EOF || ((j == '\0' || j == '\n')
+                                       && c != ' ' && c != '\t')) {
                                if (c != EOF) {
 #ifdef LINUX_STDIO
                                        --iob->_IO_read_ptr;
@@ -575,11 +576,16 @@ void
 thisisanmbox(FILE *iob)
 {
        register int c;
-       register long pos;
        char text[10];
        register char *cp;
        register char *delimstr;
 
+       c = getc(iob); 
+       if (feof(iob)) {
+               return;
+       }
+       ungetc(c, iob);
+
        /*
        ** Figure out what the message delimitter string is for this
        ** maildrop.  (This used to be part of m_Eom but I didn't like
@@ -592,7 +598,6 @@ thisisanmbox(FILE *iob)
        ** abort.
        */
 
-       pos = ftell(iob);
        if (fread(text, sizeof(*text), 5, iob) != 5) {
                adios(NULL, "Read error");
        }