- move buffer allocation schemes to libbb.h
[oweals/busybox.git] / libbb / compare_string_array.c
1 /* vi:set ts=4:*/
2 /*
3  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
4  */
5
6 #include <string.h>
7 #include "libbb.h"
8
9 /* returns the array number of the string */
10 int compare_string_array(const char * const string_array[], const char *key)
11 {
12         int i;
13
14         for (i = 0; string_array[i] != 0; i++) {
15                 if (strcmp(string_array[i], key) == 0) {
16                         return i;
17                 }
18         }
19         return -i;
20 }
21