home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.uv.es
/
2014.11.ftp.uv.es.tar
/
ftp.uv.es
/
pub
/
unix
/
elm-2.4-pl20.tar.Z
/
elm-2.4-pl20.tar
/
lib
/
header_cmp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-01-12
|
2KB
|
76 lines
static char rcsid[] = "@(#)$Id: header_cmp.c,v 5.2 1992/11/07 20:59:49 syd Exp $";
/*******************************************************************************
* The Elm Mail System - $Revision: 5.2 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
*******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to:
*
* Syd Weinstein, Elm Coordinator
* elm@DSI.COM dsinc!elm
*
*******************************************************************************
* $Log: header_cmp.c,v $
* Revision 5.2 1992/11/07 20:59:49 syd
* fix typo
*
* Revision 5.1 1992/11/07 20:16:29 syd
* Initial Checkin
*
*
******************************************************************************/
/**
compare a header, ignoring case and allowing linear white space
around the :. Header must be anchored to the start of the line.
returns NULL if no match, or first character after trailing linear
white space of the :.
**/
#include "headers.h"
#include <ctype.h>
#ifdef BSD
#undef tolower
#endif
char *
header_cmp(header, prefix, suffix)
register char *header, *prefix, *suffix;
{
int len;
len = strlen(prefix);
if (strincmp(header, prefix, len))
return(NULL);
/* skip over while space if any */
header += len;
if (*header != ':') /* headers must end in a : */
return(NULL);
/* skip over while space if any */
header++;
while (*header) {
if (!whitespace(*header))
break;
header++;
}
if (suffix != NULL) {
len = strlen(suffix);
if (len > 0)
if (strincmp(header, suffix, len))
return(NULL);
}
return(header);
}