Bernhard Reutner-Fischer | 421d9e5 | 2006-04-03 16:39:31 +0000 | [diff] [blame^] | 1 | /* vi:set ts=4:*/ |
Glenn L McGrath | b963875 | 2002-12-02 00:01:36 +0000 | [diff] [blame] | 2 | /* |
Bernhard Reutner-Fischer | 421d9e5 | 2006-04-03 16:39:31 +0000 | [diff] [blame^] | 3 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
Glenn L McGrath | b963875 | 2002-12-02 00:01:36 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <string.h> |
Bernhard Reutner-Fischer | 421d9e5 | 2006-04-03 16:39:31 +0000 | [diff] [blame^] | 7 | #include "libbb.h" |
Glenn L McGrath | b963875 | 2002-12-02 00:01:36 +0000 | [diff] [blame] | 8 | |
| 9 | /* returns the array number of the string */ |
Rob Landley | ca08771 | 2006-03-29 16:52:56 +0000 | [diff] [blame] | 10 | int compare_string_array(const char * const string_array[], const char *key) |
Glenn L McGrath | b963875 | 2002-12-02 00:01:36 +0000 | [diff] [blame] | 11 | { |
"Vladimir N. Oleynik" | cc34344 | 2005-11-26 10:45:26 +0000 | [diff] [blame] | 12 | int i; |
Glenn L McGrath | b963875 | 2002-12-02 00:01:36 +0000 | [diff] [blame] | 13 | |
| 14 | for (i = 0; string_array[i] != 0; i++) { |
| 15 | if (strcmp(string_array[i], key) == 0) { |
"Vladimir N. Oleynik" | cc34344 | 2005-11-26 10:45:26 +0000 | [diff] [blame] | 16 | return i; |
Glenn L McGrath | b963875 | 2002-12-02 00:01:36 +0000 | [diff] [blame] | 17 | } |
| 18 | } |
"Vladimir N. Oleynik" | cc34344 | 2005-11-26 10:45:26 +0000 | [diff] [blame] | 19 | return -i; |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 20 | } |
| 21 | |