| Last change
 on this file since d10dbee was             7258c6a, checked in by Thomas Lopatic <thomas@…>, 8 years ago | 
        
          | 
Use standard integer types.
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            738 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 | int16_t strlcmp(int8_t *s, int8_t *l[]) | 
|---|
| 18 | { | 
|---|
| 19 | int16_t rc; | 
|---|
| 20 |  | 
|---|
| 21 | rc = 0; | 
|---|
| 22 |  | 
|---|
| 23 | while (l[rc]) { | 
|---|
| 24 |  | 
|---|
| 25 | if (0 == strcmp(s, l[rc])) | 
|---|
| 26 | return(++rc); | 
|---|
| 27 |  | 
|---|
| 28 | rc++; | 
|---|
| 29 | } | 
|---|
| 30 |  | 
|---|
| 31 | return(0); | 
|---|
| 32 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.