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