1 2 /******************************************************************************* 3 * The Elm Mail System - $Revision: 5.1 $ $State: Exp $ 4 * 5 * Copyright (c) 1988-1992 USENET Community Trust 6 * Copyright (c) 1986,1987 Dave Taylor 7 ******************************************************************************/ 8 9 /** compare strings ignoring case - length limited 10 **/ 11 12 #include <ctype.h> 13 14 #ifdef WFP_DEBUG 15 #include <stdio.h> 16 #include <stdlib.h> 17 #include "/home/wfp5p/bin/debug_include/malloc.h" 18 #endif 19 20 21 #ifdef BSD 22 #undef tolower 23 #undef toupper 24 #endif 25 strincmp(s1,s2,n)26int strincmp(s1, s2, n) 27 register char *s1, *s2; 28 register int n; 29 { 30 /* case insensitive comparison */ 31 register int d; 32 33 while (--n >= 0) 34 { 35 d = (isupper(*s1) ? tolower(*s1) : *s1) 36 - (isupper(*s2) ? tolower(*s2) : *s2); 37 if (d != 0 || *s1 == '\0' || *s2 == '\0') 38 return d; 39 ++s1; 40 ++s2; 41 } 42 return (0); 43 } 44