Missing dependencies added.
[AROS-Contrib.git] / rexx / lstring / verify.c
blobe7f947e5d61b765005156ab95f62f8e946e28d71
1 /*
2 * $Header$
3 * $Log$
4 * Revision 1.1 2001/04/04 05:43:38 wang
5 * First commit: compiles on Linux, Amiga, Windows, Windows CE, generic gcc
7 * Revision 1.1 1998/07/02 17:20:58 bnv
8 * Initial Version
12 #include <string.h>
13 #include <lstring.h>
15 /* --------------------- Lverify ----------------------- *
16 * str - string that we check every char *
17 * if it exists on 'ref' *
18 * ref - reference characters *
19 * match - FALSE = find non matching chars *
20 * TRUE = find only matching chars *
21 * start - starting position [1,len] *
22 * returns *
23 * 0 if every char is found (or not found) *
24 * according to match *
25 * pos else non matching (or matching) position *
26 * ------------------------------------------------------ */
27 long
28 Lverify( const PLstr str, const PLstr ref, const bool match, long start )
30 bool found;
32 L2STR(str);
33 L2STR(ref);
35 start--;
36 if (start<0) start = 0;
37 if (start >= LLEN(*str)) return LNOTFOUND;
39 for (; start<LLEN(*str); start++) {
40 found = (MEMCHR(LSTR(*ref), LSTR(*str)[start], LLEN(*ref))==NULL);
41 if (found ^ match) return start+1;
43 return LNOTFOUND;
44 } /* Lverify */