Merge commit '00f1a4f432b3d8aad1aa270e91c44c57f03ef407'
[unleashed.git] / usr / src / cmd / mail / isit.c
blob70492bc7a32fe296cca03f24516c087cc5007d48
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 1995 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
30 #include "mail.h"
33 * isit(lp, type) -- match "name" portion of
34 * "name: value" pair
35 * lp -> pointer to line to check
36 * type -> type of header line to match
37 * returns
38 * TRUE -> lp matches header type (case independent)
39 * FALSE -> no match
41 * Execpt for H_FORM type, matching is case insensitive (bug 1173101)
43 int
44 isit(lp, type)
45 register char *lp;
46 register int type;
48 register char *p;
50 switch (type) {
51 case H_FROM:
52 for (p = header[type].tag; *lp && *p; lp++, p++) {
53 if (*p != *lp) {
54 return (FALSE);
57 break;
58 default:
59 for (p = header[type].tag; *lp && *p; lp++, p++) {
60 if (toupper(*p) != toupper(*lp)) {
61 return (FALSE);
64 break;
66 if (*p == '\0') {
67 return (TRUE);
69 return (FALSE);