75 lines
1.7 KiB
C
Executable File
75 lines
1.7 KiB
C
Executable File
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
|
/* All Rights Reserved */
|
|
|
|
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
|
/* The copyright notice above does not evidence any */
|
|
/* actual or intended publication of such source code. */
|
|
|
|
#pragma ident "@(#)isheader.c 1.5 95/10/15 SMI" /* SVr4.0 1. */
|
|
#include "mail.h"
|
|
/*
|
|
* isheader(lp, ctf) - check if lp is header line and return type
|
|
* lp -> pointer to line
|
|
* ctfp -> continuation flag (should be FALSE the first time
|
|
* isheader() is called on a message. isheader() sets
|
|
* it for the remaining calls to that message)
|
|
* returns
|
|
* FALSE -> not header line
|
|
* H_* -> type of header line found.
|
|
*/
|
|
int
|
|
isheader(lp, ctfp)
|
|
char *lp;
|
|
int *ctfp;
|
|
{
|
|
register char *p, *q;
|
|
register int i;
|
|
|
|
p = lp;
|
|
while((*p) && (*p != '\n') && (isspace(*p))) {
|
|
p++;
|
|
}
|
|
if((*p == NULL) || (*p == '\n')) {
|
|
/* blank line */
|
|
return (FALSE);
|
|
}
|
|
|
|
if ((*ctfp) && ((*lp == ' ') || (*lp == '\t'))) {
|
|
return(H_CONT);
|
|
}
|
|
|
|
*ctfp = FALSE;
|
|
for (i = 1; i < H_CONT; i++) {
|
|
if (!isit(lp, i)) {
|
|
continue;
|
|
}
|
|
if ((i == H_FROM) || (i == H_FROM1)) {
|
|
/*
|
|
* Should NEVER get 'From ' or '>From ' line on stdin
|
|
* if invoked as mail (rather than rmail) since
|
|
* 'From ' and/or '>From ' lines are generated by
|
|
* program itself. Therefore, if it DOES match and
|
|
* ismail == TRUE, it must be part of the content.
|
|
*/
|
|
if (sending && ismail && !deliverflag) {
|
|
return (FALSE);
|
|
}
|
|
}
|
|
*ctfp = TRUE;
|
|
return (i);
|
|
}
|
|
/*
|
|
* Check if name: value pair
|
|
*/
|
|
if ((p = strpbrk(lp, ":")) != NULL ) {
|
|
for(q = lp; q < p; q++) {
|
|
if ((*q == ' ') || (!isprint(*q))) {
|
|
return(FALSE);
|
|
}
|
|
}
|
|
*ctfp = TRUE;
|
|
return(H_NAMEVALUE);
|
|
}
|
|
return(FALSE);
|
|
}
|