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