3252 Need a proper flock() implementation
[unleashed.git] / usr / src / cmd / tbl / ts.c
blob42937aaa5ca42fc55bd5bcf6d4356010773ff350
1 /*
2 * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
9 /*
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley software License Agreement
12 * specifies the terms and conditions for redistribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
17 /* ts.c: minor string processing subroutines */
18 int
19 match(char *s1, char *s2)
21 while (*s1 == *s2)
22 if (*s1++ == '\0')
23 return(1);
24 else
25 s2++;
26 return(0);
29 int
30 prefix(char *small, char *big)
32 int c;
33 while ((c= *small++) == *big++)
34 if (c==0) return(1);
35 return(c==0);
38 int
39 letter(int ch)
41 if (ch >= 'a' && ch <= 'z')
42 return(1);
43 if (ch >= 'A' && ch <= 'Z')
44 return(1);
45 return(0);
48 int
49 numb(char *str)
51 /* convert to integer */
52 int k;
53 for (k=0; *str >= '0' && *str <= '9'; str++)
54 k = k*10 + *str - '0';
55 return(k);
58 int
59 digit(int x)
61 return(x>= '0' && x<= '9');
64 int
65 max(int a, int b)
67 return( a>b ? a : b);
70 void
71 tcopy(char *s, char *t)
73 while (*s++ = *t++);