Last change
on this file since f806726 was b28a12e, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Zero redundant declarations.
|
-
Property mode
set to
100644
|
File size:
757 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 | #include "ram.h"
|
---|
18 |
|
---|
19 | int16_t strlcmp(int8_t *s, int8_t *l[])
|
---|
20 | {
|
---|
21 | int16_t 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 | }
|
---|
35 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.