Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!bionet!ames!pacbell!rencon!esfenn!dah From: dah@esfenn.UUCP (Darrin Hyrup) Newsgroups: comp.mail.sendmail Subject: Re: undefined: strcasecmp? Message-ID: <475@esfenn.UUCP> Date: 19 Aug 89 07:49:33 GMT References: <1989Aug16.191624.6076@hfh.edu> Reply-To: dah@.UUCP (Darrin Hyrup) Organization: Esfenn, Hayward, Ca. Lines: 27 strcasecmp() is a case insensitive string compare function. Not usually bundled with many default libraries. Here is a version of the function for ya... int cstrcmp(s1, s2) /* also known as strcasecmp() */ register char *s1, *s2; { while(tolower(*s1) == tolower(*s2++)) if(*s1++ == '\0') return(0); return(tolower(*s1) - tolower(*--s2)); } int cstrncmp(s1, s2, n) /* also known as strncasecmp() */ register char *s1, *s2; register int n; { while(--n >= 0 && tolower(*s1) == tolower(*s2++)) if(*s1++ == '\0') return(0); return(n < 0 ? 0 : tolower(*s1) - tolower(*--s2)); } Hope that helps! Darrin Hyrup dah@esfenn.UUCP