1 /*- 2 * %sccs.include.proprietary.c% 3 */ 4 5 #ifndef lint 6 static char sccsid[] = "@(#)ts.c 4.3 (Berkeley) 04/18/91"; 7 #endif /* not lint */ 8 9 /* ts.c: minor string processing subroutines */ 10 match (s1, s2) 11 char *s1, *s2; 12 { 13 while (*s1 == *s2) 14 if (*s1++ == '\0') 15 return(1); 16 else 17 s2++; 18 return(0); 19 } 20 prefix(small, big) 21 char *small, *big; 22 { 23 int c; 24 while ((c= *small++) == *big++) 25 if (c==0) return(1); 26 return(c==0); 27 } 28 letter (ch) 29 { 30 if (ch >= 'a' && ch <= 'z') 31 return(1); 32 if (ch >= 'A' && ch <= 'Z') 33 return(1); 34 return(0); 35 } 36 numb(str) 37 char *str; 38 { 39 /* convert to integer */ 40 int k; 41 for (k=0; *str >= '0' && *str <= '9'; str++) 42 k = k*10 + *str - '0'; 43 return(k); 44 } 45 digit(x) 46 { 47 return(x>= '0' && x<= '9'); 48 } 49 max(a,b) 50 { 51 return( a>b ? a : b); 52 } 53 tcopy (s,t) 54 char *s, *t; 55 { 56 while (*s++ = *t++); 57 } 58