1 /* ts.c 4.1 83/02/12 */ 2 3 /* ts.c: minor string processing subroutines */ 4 match (s1, s2) 5 char *s1, *s2; 6 { 7 while (*s1 == *s2) 8 if (*s1++ == '\0') 9 return(1); 10 else 11 s2++; 12 return(0); 13 } 14 prefix(small, big) 15 char *small, *big; 16 { 17 int c; 18 while ((c= *small++) == *big++) 19 if (c==0) return(1); 20 return(c==0); 21 } 22 letter (ch) 23 { 24 if (ch >= 'a' && ch <= 'z') 25 return(1); 26 if (ch >= 'A' && ch <= 'Z') 27 return(1); 28 return(0); 29 } 30 numb(str) 31 char *str; 32 { 33 /* convert to integer */ 34 int k; 35 for (k=0; *str >= '0' && *str <= '9'; str++) 36 k = k*10 + *str - '0'; 37 return(k); 38 } 39 digit(x) 40 { 41 return(x>= '0' && x<= '9'); 42 } 43 max(a,b) 44 { 45 return( a>b ? a : b); 46 } 47 tcopy (s,t) 48 char *s, *t; 49 { 50 while (*s++ = *t++); 51 } 52