1 #ifndef lint 2 static char sccsid[] = "@(#)prefix.c 5.3 (Berkeley) 06/20/85"; 3 #endif 4 5 /*LINTLIBRARY*/ 6 7 /* 8 * check s2 for prefix s1 9 * 10 * return 0 - != 11 * return 1 - == 12 */ 13 14 prefix(s1, s2) 15 register char *s1, *s2; 16 { 17 register char c; 18 19 while ((c = *s1++) == *s2++) 20 if (c == '\0') 21 return 1; 22 return c == '\0'; 23 } 24 25 /* 26 * check s2 for prefix s1 with a wildcard character ? 27 * 28 * return 0 - != 29 * return 1 - == 30 */ 31 32 wprefix(s1, s2) 33 register char *s1, *s2; 34 { 35 register char c; 36 37 while ((c = *s1++) != '\0') 38 if (*s2 == '\0' || (c != *s2++ && c != '?')) 39 return 0; 40 return 1; 41 } 42