Annotation of 43BSD/contrib/notes/src/parse.c, revision 1.1.1.1

1.1       root        1: #include       "dump.h"
                      2: #include       <stdio.h>
                      3: 
                      4: #ifdef RCSIDENT
                      5: static char *RCSid = "$Header: parse.c,v 1.7 85/01/18 15:42:07 notes Rel $";
                      6: #endif RCSIDENT
                      7: 
                      8: /*
                      9:  *     given a header line in the basic RFC-822 format,
                     10:  *     this routine scans the name and determines a variable
                     11:  *     name for it.
                     12:  *
                     13:  *     Ray Essick, March 1984
                     14:  *             Stolen from the code I did for the BA 456 class....
                     15:  */
                     16: 
                     17: rfcparse (line, varlist)
                     18: char   *line;
                     19: struct dump_f  *varlist;
                     20: {
                     21:     char    name[BUFSIZ];                              /* hold name */
                     22: 
                     23:     if (sscanf (line, "%[^:]:", name) != 1)            /* get field name */
                     24:     {
                     25:        return (-1);                                    /* bogus line */
                     26:     }
                     27: 
                     28:     for (; varlist -> du_name[0]; varlist++)           /* empty string at end */
                     29:     {
                     30:        if (!strcmp (name, varlist -> du_name))         /* matched */
                     31:            return (varlist -> du_number);              /* which is it */
                     32:     }
                     33:     return (-1);                                       /* never reached */
                     34: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.