]> diplodocus.org Git - nmh/commitdiff
Moved scan_input() from uip/post.c to sbr/utils.c.
authorDavid Levine <levinedl@acm.org>
Thu, 6 Oct 2016 21:53:00 +0000 (17:53 -0400)
committerDavid Levine <levinedl@acm.org>
Thu, 6 Oct 2016 21:53:00 +0000 (17:53 -0400)
h/utils.h
sbr/utils.c
uip/post.c

index 00249be447fd7670864768911b3d5d644b4f980b..9e515989cf101ced93b944e033c9382f22c3ddec 100644 (file)
--- a/h/utils.h
+++ b/h/utils.h
@@ -58,6 +58,20 @@ char *nmh_strcasestr (const char *, const char *);
  */
 int contains8bit(const char *start, const char *end);
 
  */
 int contains8bit(const char *start, const char *end);
 
+/*
+ * See if file has any 8-bit bytes.
+ * Arguments include:
+ *
+ * fd          - file descriptor
+ * eightbit    - address of result, will be set to 1 if the file contains
+ *                any 8-bit bytes, 0 otherwise.
+ *
+ * Returns OK on success, NOTOK on read failure.
+ *
+ */
+int scan_input (int fd, int *eightbit);
+
+
 /*
  * Compares prior version of nmh with current version.  Returns 1
  * if they compare the be the same, 0 if not.
 /*
  * Compares prior version of nmh with current version.  Returns 1
  * if they compare the be the same, 0 if not.
index cf920a39e457e9f4aa50b55f7c2ca3b83df6a236..e5ed66aa1d499a55d7edc1226058820e3fdef365 100644 (file)
@@ -484,3 +484,25 @@ contains8bit(const char *start, const char *end)
 
     return 0;
 }
 
     return 0;
 }
+
+
+/*
+ * See if input has any 8-bit bytes.
+ */
+int
+scan_input (int fd, int *eightbit) {
+    int state;
+    char buf[BUFSIZ];
+
+    *eightbit = 0;
+    lseek (fd, (off_t) 0, SEEK_SET);
+
+    while ((state = read (fd, buf, sizeof buf)) > 0) {
+        if (contains8bit (buf, buf + state)) {
+            *eightbit = 1;
+            return OK;
+        }
+    }
+
+    return state == NOTOK  ?  NOTOK  :  OK;
+}
index d1e58ebf8e6037053d5e743d0ea0eceeb66a347f..d385219ecd1bd64c883fafc63da22b4307f3d61e 100644 (file)
@@ -305,7 +305,6 @@ static void fcc (char *, char *);
 static void die (char *, char *, ...);
 static void post (char *, int, int, int, char *, int, char *);
 static void do_text (char *file, int fd);
 static void die (char *, char *, ...);
 static void post (char *, int, int, int, char *, int, char *);
 static void do_text (char *file, int fd);
-static int scan_input (int, int *);
 static void do_an_address (struct mailname *, int);
 static void do_addresses (int, int);
 static int find_prefix (void);
 static void do_an_address (struct mailname *, int);
 static void do_addresses (int, int);
 static int find_prefix (void);
@@ -1855,27 +1854,6 @@ do_text (char *file, int fd)
 }
 
 
 }
 
 
-/*
- * See if input has any 8-bit bytes.
- */
-static int
-scan_input (int fd, int *eightbit) {
-    int state;
-    char buf[BUFSIZ];
-
-    lseek (fd, (off_t) 0, SEEK_SET);
-
-    while ((state = read (fd, buf, sizeof buf)) > 0) {
-        if (contains8bit (buf, buf + state)) {
-            *eightbit = 1;
-            return OK;
-        }
-    }
-
-    return state == NOTOK  ?  NOTOK  :  OK;
-}
-
-
 /*
  * SIGNAL HANDLING
  */
 /*
  * SIGNAL HANDLING
  */