home *** CD-ROM | disk | FTP | other *** search
- /*********
- * Function: CHRFOUND
- * By: Tom Rettig
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *
- * Syntax: CHRFOUND( <string1>, <string2> )
- * Return: True if every character in <string1> is also contained in <string2>,
- * regardless of order, otherwise False
- * <string1> and <string2> are both <expC>
- *********/
-
- #include "trlib.h"
-
- TRTYPE chrfound()
- {
- char *s1, *s2, *s3;
- int found = FALSE;
-
- if ( PCOUNT==2 && ISCHAR(1) && ISCHAR(2) )
- {
- s1 = _parc(1);
- s2 = _parc(2);
- s3 = _parc(2);
-
- while ( *s1 )
- {
- while ( *s2 )
- {
- if ( *s1 == *s2++ )
- {
- found = TRUE;
- break;
- }
- }
- if ( found && *(++s1) ) /* more chars remain to check */
- {
- found = FALSE;
- s2 = s3;
- }
- else
- break;
- }
- _retl( found );
- }
- else
- _retl( ERROR ); /* error on logical */
- }
-
-