Move #include from h/mh.h to source files
[mmh] / sbr / m_getfld.c
index 2ebb44a..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.
@@ -154,14 +155,6 @@ static int (*eom_action)(int) = NULL;
 # define DEFINED__FILBUF_TO_SOMETHING_SPECIFIC
 #endif
 
-#ifdef SCO_5_STDIO
-# define _ptr  __ptr
-# define _cnt  __cnt
-# define _base __base
-# define _filbuf(fp)  ((fp)->__cnt = 0, __filbuf(fp))
-# define DEFINED__FILBUF_TO_SOMETHING_SPECIFIC
-#endif
-
 #ifndef DEFINED__FILBUF_TO_SOMETHING_SPECIFIC
 extern int  _filbuf(FILE*);
 #endif
@@ -431,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;
@@ -583,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
@@ -600,7 +598,6 @@ thisisanmbox(FILE *iob)
        ** abort.
        */
 
-       pos = ftell(iob);
        if (fread(text, sizeof(*text), 5, iob) != 5) {
                adios(NULL, "Read error");
        }