Annotation of 42BSD/usr.lib/sendmail/aux/matchhdr.c, revision 1.1

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

unix.superglobalmegacorp.com

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