1 /* vi: set sw=4 ts=4: */
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 /* returns the array index of the string */
9 /* (index of first match is returned, or -1) */
10 int index_in_str_array(const char * const string_array[], const char *key)
14 for (i = 0; string_array[i] != 0; i++) {
15 if (strcmp(string_array[i], key) == 0) {
22 /* returns the array index of the string, even if it matches only a beginning */
23 /* (index of first match is returned, or -1) */
24 int index_in_substr_array(const char * const string_array[], const char *key)
27 int len = strlen(key);
31 for (i = 0; string_array[i] != 0; i++) {
32 if (strncmp(string_array[i], key, len) == 0) {