Annotation of 43BSDReno/usr.sbin/sendmail/aux/matchhdr.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1983 Eric P. Allman
        !             3:  * Copyright (c) 1988 Regents of the University of California.
        !             4:  * All rights reserved.
        !             5:  *
        !             6:  * Redistribution and use in source and binary forms are permitted provided
        !             7:  * that: (1) source distributions retain this entire copyright notice and
        !             8:  * comment, and (2) distributions including binaries display the following
        !             9:  * acknowledgement:  ``This product includes software developed by the
        !            10:  * University of California, Berkeley and its contributors'' in the
        !            11:  * documentation or other materials provided with the distribution and in
        !            12:  * all advertising materials mentioning features or use of this software.
        !            13:  * Neither the name of the University nor the names of its contributors may
        !            14:  * be used to endorse or promote products derived from this software without
        !            15:  * specific prior written permission.
        !            16:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            17:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            18:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            19:  */
        !            20: 
        !            21: #ifndef lint
        !            22: char copyright[] =
        !            23: "@(#) Copyright (c) 1988 Regents of the University of California.\n\
        !            24:  All rights reserved.\n";
        !            25: #endif /* not lint */
        !            26: 
        !            27: #ifndef lint
        !            28: static char sccsid[] = "@(#)matchhdr.c 5.4 (Berkeley) 6/1/90";
        !            29: #endif /* not lint */
        !            30: 
        !            31: # include <stdio.h>
        !            32: # include <ctype.h>
        !            33: # include <useful.h>
        !            34: 
        !            35: SCCSID(@(#)matchhdr.c  5.4             6/1/90);
        !            36: 
        !            37: /*
        !            38: **  MATCHHDR -- Match header line
        !            39: **
        !            40: **     Matches a header line in arpanet format (case and white
        !            41: **     space is ignored).
        !            42: **
        !            43: **     This routine is used by arpa-mailer and sendmail.
        !            44: **
        !            45: **     Parameters:
        !            46: **             line -- the line to match against.
        !            47: **             pat -- the pattern to match against; must be in
        !            48: **                     lower case.
        !            49: **
        !            50: **     Returns:
        !            51: **             address of the 'value' of the pattern (the beginning
        !            52: **                     of the non-white string following the delim).
        !            53: **             NULL if none found.
        !            54: **
        !            55: **     Side Effects:
        !            56: **             none
        !            57: **
        !            58: **     Called By:
        !            59: **             maketemp
        !            60: **             sendmail [arpa.c]
        !            61: **
        !            62: **     Deficiencies:
        !            63: **             It doesn't handle folded lines.
        !            64: */
        !            65: 
        !            66: char *
        !            67: matchhdr(line, pat)
        !            68:        char *line;
        !            69:        char *pat;
        !            70: {
        !            71:        register char *p;
        !            72:        register char *q;
        !            73: 
        !            74:        for (q = pat, p = line; *q != '\0'; p++, q++)
        !            75:                if (lowercase(*p) != *q)
        !            76:                        return (NULL);
        !            77:        while (isspace(*p))
        !            78:                p++;
        !            79:        if (*p != ':')
        !            80:                return (NULL);
        !            81:        while (isspace(*++p))
        !            82:                continue;
        !            83:        return (*p == '\0' ? NULL : p);
        !            84: }
        !            85: /*
        !            86: **  LOWERCASE -- Convert a character to lower case
        !            87: **
        !            88: **     If the argument is an upper case letter, it is converted
        !            89: **     to a lower case letter, otherwise it is passed through
        !            90: **     unchanged.
        !            91: **
        !            92: **     Parameters:
        !            93: **             c -- the character to check.
        !            94: **
        !            95: **     Returns:
        !            96: **             c converted to lower case.
        !            97: **
        !            98: **     Side Effects:
        !            99: **             none
        !           100: **
        !           101: **     Called By:
        !           102: **             matchhdr
        !           103: */
        !           104: 
        !           105: lowercase(c)
        !           106:        register char c;
        !           107: {
        !           108:        if (isupper(c))
        !           109:                c -= 'A' - 'a';
        !           110:        return (c);
        !           111: }

unix.superglobalmegacorp.com

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