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