xref: /illumos-gate/usr/src/cmd/tbl/ts.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
2 /*	  All Rights Reserved  	*/
3 
4 
5 /*
6  * Copyright (c) 1980 Regents of the University of California.
7  * All rights reserved. The Berkeley software License Agreement
8  * specifies the terms and conditions for redistribution.
9  */
10 
11 /*
12  * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
13  * All Rights Reserved.
14  */
15 
16 #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1	*/
17 
18  /* ts.c: minor string processing subroutines */
19 match (s1, s2)
20 	char *s1, *s2;
21 {
22 	while (*s1 == *s2)
23 		if (*s1++ == '\0')
24 			return(1);
25 		else
26 			s2++;
27 	return(0);
28 }
29 prefix(small, big)
30 	char *small, *big;
31 {
32 int c;
33 while ((c= *small++) == *big++)
34 	if (c==0) return(1);
35 return(c==0);
36 }
37 letter (ch)
38 	{
39 	if (ch >= 'a' && ch <= 'z')
40 		return(1);
41 	if (ch >= 'A' && ch <= 'Z')
42 		return(1);
43 	return(0);
44 	}
45 numb(str)
46 	char *str;
47 	{
48 	/* convert to integer */
49 	int k;
50 	for (k=0; *str >= '0' && *str <= '9'; str++)
51 		k = k*10 + *str - '0';
52 	return(k);
53 	}
54 digit(x)
55 	{
56 	return(x>= '0' && x<= '9');
57 	}
58 max(a,b)
59 {
60 return( a>b ? a : b);
61 }
62 tcopy (s,t)
63 	char *s, *t;
64 {
65 	while (*s++ = *t++);
66 }
67