# 2.11BSD#431 - /usr/src/usr.sbin/sendmail.MX/aux/matchhdr.c

##### Functions

    lowercase         X
    matchhdr          X

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

#### Defined functions

lowercase defined in line 89; used 1 times

- in line 59

matchhdr defined in line 50; used 9 times

- in /usr/src/usr.sbin/sendmail.MX/aux/arpa.c line 251, 336-344(5), 351, 379(2)

#### Defined variables

SccsId defined in line 12; never used

Last modified: 1985-06-08 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 880 |