Last change
on this file since 0170798 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
760 bytes
|
Line | |
---|
1 | /*
|
---|
2 | ============================================================================
|
---|
3 | strlcmp(s,l) -- compare string s to list l
|
---|
4 | Version 1 -- 1987-03-03 -- D.N. Lynx Crowe
|
---|
5 |
|
---|
6 | Compares string s to each entry in the list l of strings
|
---|
7 | until a match is found or until list l is exhausted.
|
---|
8 | List l consists of a zero-entry terminated array of
|
---|
9 | pointers to zero terminated strings.
|
---|
10 | String s must be zero terminated.
|
---|
11 |
|
---|
12 | Returns 0 if no match was found, or the 1-origin index
|
---|
13 | of the string in the list l.
|
---|
14 | ============================================================================
|
---|
15 | */
|
---|
16 |
|
---|
17 | int
|
---|
18 | strlcmp(s,l)
|
---|
19 | char *s, *l[];
|
---|
20 | {
|
---|
21 | int rc;
|
---|
22 |
|
---|
23 | rc = 0;
|
---|
24 |
|
---|
25 | while (l[rc]) {
|
---|
26 |
|
---|
27 | if (0 == strcmp(s, l[rc]))
|
---|
28 | return(++rc);
|
---|
29 |
|
---|
30 | rc++;
|
---|
31 | }
|
---|
32 |
|
---|
33 | return(0);
|
---|
34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.