/*
 * 5799-WZQ (C) COPYRIGHT = NONE
 * LICENSED MATERIALS - PROPERTY OF IBM
 */
/* $Header:string.c 12.0$ */
/* $ACIS:string.c 12.0$ */
/* $Source: /ibm/acis/usr/src/bin/sh/RCS/string.c,v $ */

#ifndef lint
static char *rcsid = "$Header:string.c 12.0$";
#endif

#ifndef lint
static char sccsid[] = "@(#)string.c	4.2 8/11/83";
#endif

#
/*
 * UNIX shell
 *
 * S. R. Bourne
 * Bell Telephone Laboratories
 *
 */

#include	"defs.h"


/* ========	general purpose string handling ======== */


STRING	movstr(a,b)
	REG STRING	a, b;
{
	WHILE *b++ = *a++ DONE
	return(--b);
}

INT	any(c,s)
	REG CHAR	c;
	STRING		s;
{
	REG CHAR d;

	WHILE d = *s++
	DO	IF d==c
		THEN	return(TRUE);
		FI
	OD
	return(FALSE);
}

INT	cf(s1, s2)
	REG STRING s1, s2;
{
	WHILE *s1++ == *s2
	DO	IF *s2++==0
		THEN	return(0);
		FI
	OD
	return(*--s1 - *s2);
}

INT	length(as)
	STRING as;
{
	REG STRING s;

	IF s=as THEN WHILE *s++ DONE FI
	return(s-as);
}
