Annotation of 40BSD/cmd/delivermail/matchhdr.c, revision 1.1

1.1     ! root        1: # include <stdio.h>
        !             2: # include <ctype.h>
        !             3: 
        !             4: static char    SccsId[] = "@(#)matchhdr.c      1.3     8/2/80";
        !             5: 
        !             6: /*
        !             7: **  MATCHHDR -- Match header line
        !             8: **
        !             9: **     Matches a header line in arpanet format (case and white
        !            10: **     space is ignored).
        !            11: **
        !            12: **     This routine is used by arpa-mailer and delivermail.
        !            13: **
        !            14: **     Parameters:
        !            15: **             line -- the line to match against.
        !            16: **             pat -- the pattern to match against; must be in
        !            17: **                     lower case.
        !            18: **
        !            19: **     Returns:
        !            20: **             address of the 'value' of the pattern (the beginning
        !            21: **                     of the non-white string following the delim).
        !            22: **             NULL if none found.
        !            23: **
        !            24: **     Side Effects:
        !            25: **             none
        !            26: **
        !            27: **     Called By:
        !            28: **             maketemp
        !            29: **             sendmail [arpa.c]
        !            30: **
        !            31: **     Deficiencies:
        !            32: **             It doesn't handle folded lines.
        !            33: */
        !            34: 
        !            35: char *
        !            36: matchhdr(line, pat)
        !            37:        char *line;
        !            38:        char *pat;
        !            39: {
        !            40:        register char *p;
        !            41:        register char *q;
        !            42: 
        !            43:        for (q = pat, p = line; *q != '\0'; p++, q++)
        !            44:                if (lower(*p) != *q)
        !            45:                        return (NULL);
        !            46:        while (isspace(*p))
        !            47:                p++;
        !            48:        if (*p != ':')
        !            49:                return (NULL);
        !            50:        while (isspace(*++p))
        !            51:                continue;
        !            52:        return (*p == '\0' ? NULL : p);
        !            53: }
        !            54: /*
        !            55: **  LOWER -- Convert a character to lower case
        !            56: **
        !            57: **     If the argument is an upper case letter, it is converted
        !            58: **     to a lower case letter, otherwise it is passed through
        !            59: **     unchanged.
        !            60: **
        !            61: **     Parameters:
        !            62: **             c -- the character to check.
        !            63: **
        !            64: **     Returns:
        !            65: **             c converted to lower case.
        !            66: **
        !            67: **     Side Effects:
        !            68: **             none
        !            69: **
        !            70: **     Called By:
        !            71: **             matchhdr
        !            72: */
        !            73: 
        !            74: lower(c)
        !            75:        register char c;
        !            76: {
        !            77:        if (isupper(c))
        !            78:                c -= 'A' - 'a';
        !            79:        return (c);
        !            80: }

unix.superglobalmegacorp.com

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