document distributed with 4.2BSD
[unix-history] / usr / src / usr.bin / mail / head.c
index bb6978a..80cb5fd 100644 (file)
@@ -1,4 +1,12 @@
-#
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char *sccsid = "@(#)head.c      5.2 (Berkeley) %G%";
+#endif not lint
 
 #include "rcv.h"
 
 
 #include "rcv.h"
 
@@ -8,8 +16,6 @@
  * Routines for processing and detecting headlines.
  */
 
  * Routines for processing and detecting headlines.
  */
 
-static char *SccsId = "@(#)head.c      1.2 %G%";
-
 /*
  * See if the passed line buffer is a mail header.
  * Return true if yes.  Note the extreme pains to
 /*
  * See if the passed line buffer is a mail header.
  * Return true if yes.  Note the extreme pains to
@@ -24,7 +30,7 @@ ishead(linebuf)
        char parbuf[BUFSIZ];
 
        cp = linebuf;
        char parbuf[BUFSIZ];
 
        cp = linebuf;
-       if (!isname("From ", cp, 5))
+       if (strncmp("From ", cp, 5) != 0)
                return(0);
        parse(cp, &hl, parbuf);
        if (hl.l_from == NOSTR || hl.l_date == NOSTR) {
                return(0);
        parse(cp, &hl, parbuf);
        if (hl.l_from == NOSTR || hl.l_date == NOSTR) {
@@ -82,7 +88,7 @@ parse(line, hl, pbuf)
        dp = nextword(cp, word);
        if (!equal(word, ""))
                hl->l_from = copyin(word, &sp);
        dp = nextword(cp, word);
        if (!equal(word, ""))
                hl->l_from = copyin(word, &sp);
-       if (isname(dp, "tty", 3)) {
+       if (strncmp(dp, "tty", 3) == 0) {
                cp = nextword(dp, word);
                hl->l_tty = copyin(word, &sp);
                if (cp != NOSTR)
                cp = nextword(dp, word);
                hl->l_tty = copyin(word, &sp);
                if (cp != NOSTR)
@@ -117,50 +123,6 @@ copyin(src, space)
        return(top);
 }
 
        return(top);
 }
 
-/*
- * See if the two passed strings agree in the first n characters.
- * Return true if they do, gnu.
- */
-
-isname(as1, as2, acount)
-       char *as1, *as2;
-{
-       register char *s1, *s2;
-       register count;
-
-       s1 = as1;
-       s2 = as2;
-       count = acount;
-       if (count > 0)
-               do
-                       if (*s1++ != *s2++)
-                               return(0);
-               while (--count);
-       return(1);
-}
-
-/*
- * See if the two passed strings agree in the first n characters.
- * Return true if they do, ignoring case.
- */
-
-icisname(as1, as2, acount)
-       char *as1, *as2;
-{
-       register char *s1, *s2;
-       register count;
-
-       s1 = as1;
-       s2 = as2;
-       count = acount;
-       if (count > 0)
-               do
-                       if (raise(*s1++) != raise(*s2++))
-                               return(0);
-               while (--count);
-       return(1);
-}
-
 /*
  * Test to see if the passed string is a ctime(3) generated
  * date string as documented in the manual.  The template
 /*
  * Test to see if the passed string is a ctime(3) generated
  * date string as documented in the manual.  The template
@@ -266,7 +228,14 @@ nextword(wp, wbuf)
        }
        cp2 = wbuf;
        while (!any(*cp, " \t") && *cp != '\0')
        }
        cp2 = wbuf;
        while (!any(*cp, " \t") && *cp != '\0')
-               *cp2++ = *cp++;
+               if (*cp == '"') {
+                       *cp2++ = *cp++;
+                       while (*cp != '\0' && *cp != '"')
+                               *cp2++ = *cp++;
+                       if (*cp == '"')
+                               *cp2++ = *cp++;
+               } else
+                       *cp2++ = *cp++;
        *cp2 = '\0';
        while (any(*cp, " \t"))
                cp++;
        *cp2 = '\0';
        while (any(*cp, " \t"))
                cp++;