1/* 2 * Copyright 1990 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 6/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 7/* All Rights Reserved */ 8 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. 13 */ 14 15#pragma ident "%Z%%M% %I% %E% SMI" 16 17 /* ts.c: minor string processing subroutines */ 18int 19match(char *s1, char *s2) 20{ 21 while (*s1 == *s2) 22 if (*s1++ == '\0') 23 return(1); 24 else 25 s2++; 26 return(0); 27} 28 29int 30prefix(char *small, char *big) 31{ 32int c; 33while ((c= *small++) == *big++) 34 if (c==0) return(1); 35return(c==0); 36} 37 38int 39letter(int ch) 40{ 41 if (ch >= 'a' && ch <= 'z') 42 return(1); 43 if (ch >= 'A' && ch <= 'Z') 44 return(1); 45 return(0); 46} 47 48int 49numb(char *str) 50{ 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); 56} 57 58int 59digit(int x) 60{ 61 return(x>= '0' && x<= '9'); 62} 63 64int 65max(int a, int b) 66{ 67return( a>b ? a : b); 68} 69 70void 71tcopy(char *s, char *t) 72{ 73 while (*s++ = *t++); 74} 75