allow multiple words per line in file classes; require a SCANF compilation
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 11 Jan 1986 07:49:40 +0000 (23:49 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 11 Jan 1986 07:49:40 +0000 (23:49 -0800)
flag to use sscanf in F specs in order to reduce image size

SCCS-vsn: usr.sbin/sendmail/src/readcf.c 5.9
SCCS-vsn: usr.sbin/sendmail/src/version.c 5.42

usr/src/usr.sbin/sendmail/src/readcf.c
usr/src/usr.sbin/sendmail/src/version.c

index e6463d2..533995a 100644 (file)
@@ -9,7 +9,7 @@
 */
 
 #ifndef lint
 */
 
 #ifndef lint
-static char    SccsId[] = "@(#)readcf.c        5.8 (Berkeley) %G%";
+static char    SccsId[] = "@(#)readcf.c        5.9 (Berkeley) %G%";
 #endif not lint
 
 # include "sendmail.h"
 #endif not lint
 
 # include "sendmail.h"
@@ -300,7 +300,7 @@ fileclass(class, filename, fmt)
        char *filename;
        char *fmt;
 {
        char *filename;
        char *fmt;
 {
-       register FILE *f;
+       FILE *f;
        char buf[MAXLINE];
 
        f = fopen(filename, "r");
        char buf[MAXLINE];
 
        f = fopen(filename, "r");
@@ -313,12 +313,42 @@ fileclass(class, filename, fmt)
        while (fgets(buf, sizeof buf, f) != NULL)
        {
                register STAB *s;
        while (fgets(buf, sizeof buf, f) != NULL)
        {
                register STAB *s;
+               register char *p;
+# ifdef SCANF
                char wordbuf[MAXNAME+1];
 
                if (sscanf(buf, fmt, wordbuf) != 1)
                        continue;
                char wordbuf[MAXNAME+1];
 
                if (sscanf(buf, fmt, wordbuf) != 1)
                        continue;
-               s = stab(wordbuf, ST_CLASS, ST_ENTER);
-               setbitn(class, s->s_class);
+               p = wordbuf;
+# else SCANF
+               p = buf;
+# endif SCANF
+
+               /*
+               **  Break up the match into words.
+               */
+
+               while (*p != '\0')
+               {
+                       register char *q;
+
+                       /* strip leading spaces */
+                       while (isspace(*p))
+                               p++;
+                       if (*p == '\0')
+                               break;
+
+                       /* find the end of the word */
+                       q = p;
+                       while (*p != '\0' && !isspace(*p))
+                               p++;
+                       if (*p != '\0')
+                               *p++ = '\0';
+
+                       /* enter the word in the symbol table */
+                       s = stab(q, ST_CLASS, ST_ENTER);
+                       setbitn(class, s->s_class);
+               }
        }
 
        (void) fclose(f);
        }
 
        (void) fclose(f);
index 613ccc2..c0b3915 100644 (file)
@@ -9,7 +9,7 @@
 */
 
 #ifndef lint
 */
 
 #ifndef lint
-static char    SccsId[] = "@(#)version.c       5.41 (Berkeley) %G%";
+static char    SccsId[] = "@(#)version.c       5.42 (Berkeley) %G%";
 #endif not lint
 
 #endif not lint
 
-char   Version[] = "5.41";
+char   Version[] = "5.42";