113666Ssam #ifndef lint 2*23616Sbloom static char sccsid[] = "@(#)prefix.c 5.3 (Berkeley) 06/20/85"; 313666Ssam #endif 413666Ssam 5*23616Sbloom /*LINTLIBRARY*/ 6*23616Sbloom 717838Sralph /* 817838Sralph * check s2 for prefix s1 913666Ssam * 1013666Ssam * return 0 - != 1113666Ssam * return 1 - == 1213666Ssam */ 1313666Ssam 1413666Ssam prefix(s1, s2) 1513666Ssam register char *s1, *s2; 1613666Ssam { 1713666Ssam register char c; 1813666Ssam 1913666Ssam while ((c = *s1++) == *s2++) 2013666Ssam if (c == '\0') 2117838Sralph return 1; 2217838Sralph return c == '\0'; 2313666Ssam } 2413666Ssam 2517838Sralph /* 2617838Sralph * check s2 for prefix s1 with a wildcard character ? 2713666Ssam * 2813666Ssam * return 0 - != 2913666Ssam * return 1 - == 3013666Ssam */ 3113666Ssam 3213666Ssam wprefix(s1, s2) 3313666Ssam register char *s1, *s2; 3413666Ssam { 3513666Ssam register char c; 3613666Ssam 3713666Ssam while ((c = *s1++) != '\0') 3813666Ssam if (*s2 == '\0' || (c != *s2++ && c != '?')) 3917838Sralph return 0; 4017838Sralph return 1; 4113666Ssam } 42