1b551488muffin/*
2b551488muffin * Copyright 1990 Sun Microsystems, Inc.  All rights reserved.
3b551488muffin * Use is subject to license terms.
4b551488muffin */
5b551488muffin
67c478bdstevel@tonic-gate/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
77c478bdstevel@tonic-gate/*	  All Rights Reserved  	*/
87c478bdstevel@tonic-gate
97c478bdstevel@tonic-gate/*
107c478bdstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California.
117c478bdstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement
127c478bdstevel@tonic-gate * specifies the terms and conditions for redistribution.
137c478bdstevel@tonic-gate */
147c478bdstevel@tonic-gate
15b551488muffin#pragma ident	"%Z%%M%	%I%	%E% SMI"
167c478bdstevel@tonic-gate
177c478bdstevel@tonic-gate /* ts.c: minor string processing subroutines */
18b551488muffinint
19b551488muffinmatch(char *s1, char *s2)
207c478bdstevel@tonic-gate{
217c478bdstevel@tonic-gate	while (*s1 == *s2)
227c478bdstevel@tonic-gate		if (*s1++ == '\0')
237c478bdstevel@tonic-gate			return(1);
247c478bdstevel@tonic-gate		else
257c478bdstevel@tonic-gate			s2++;
267c478bdstevel@tonic-gate	return(0);
277c478bdstevel@tonic-gate}
28b551488muffin
29b551488muffinint
30b551488muffinprefix(char *small, char *big)
317c478bdstevel@tonic-gate{
327c478bdstevel@tonic-gateint c;
337c478bdstevel@tonic-gatewhile ((c= *small++) == *big++)
347c478bdstevel@tonic-gate	if (c==0) return(1);
357c478bdstevel@tonic-gatereturn(c==0);
367c478bdstevel@tonic-gate}
37b551488muffin
38b551488muffinint
39b551488muffinletter(int ch)
40b551488muffin{
417c478bdstevel@tonic-gate	if (ch >= 'a' && ch <= 'z')
427c478bdstevel@tonic-gate		return(1);
437c478bdstevel@tonic-gate	if (ch >= 'A' && ch <= 'Z')
447c478bdstevel@tonic-gate		return(1);
457c478bdstevel@tonic-gate	return(0);
46b551488muffin}
47b551488muffin
48b551488muffinint
49b551488muffinnumb(char *str)
50b551488muffin{
517c478bdstevel@tonic-gate	/* convert to integer */
527c478bdstevel@tonic-gate	int k;
537c478bdstevel@tonic-gate	for (k=0; *str >= '0' && *str <= '9'; str++)
547c478bdstevel@tonic-gate		k = k*10 + *str - '0';
557c478bdstevel@tonic-gate	return(k);
56b551488muffin}
57b551488muffin
58b551488muffinint
59b551488muffindigit(int x)
60b551488muffin{
617c478bdstevel@tonic-gate	return(x>= '0' && x<= '9');
62b551488muffin}
63b551488muffin
64b551488muffinint
65b551488muffinmax(int a, int b)
667c478bdstevel@tonic-gate{
677c478bdstevel@tonic-gatereturn( a>b ? a : b);
687c478bdstevel@tonic-gate}
69b551488muffin
70b551488muffinvoid
71b551488muffintcopy(char *s, char *t)
727c478bdstevel@tonic-gate{
737c478bdstevel@tonic-gate	while (*s++ = *t++);
747c478bdstevel@tonic-gate}
75