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