From cc34344d91cea789edde507bf85714af11daea71 Mon Sep 17 00:00:00 2001 From: "\"Vladimir N. Oleynik\"" Date: Sat, 26 Nov 2005 10:45:26 +0000 Subject: [PATCH] change the interface of libbb/compare_string_array (unsigned short to int), usaging for e2fsprogs/fsck --- e2fsprogs/fsck.c | 4 ++-- include/libbb.h | 2 +- libbb/compare_string_array.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index ae4e3d0c8..7f7ab3eb3 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -1006,11 +1006,11 @@ static int ignore(struct fs_info *fs) if (!fs_match(fs, &fs_type_compiled)) return 1; /* Are we ignoring this type? */ - if(compare_string_array(ignored_types, fs->type)) + if(compare_string_array(ignored_types, fs->type) >= 0) return 1; /* Do we really really want to check this fs? */ - wanted = compare_string_array(really_wanted, fs->type); + wanted = compare_string_array(really_wanted, fs->type) >= 0; /* See if the program is available. */ s = find_fsck(fs->type); diff --git a/include/libbb.h b/include/libbb.h index 70a9336d8..d1c6be670 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -466,7 +466,7 @@ typedef struct { } procps_status_t; extern procps_status_t * procps_scan(int save_user_arg0); -extern unsigned short compare_string_array(const char * const string_array[], const char *key); +extern int compare_string_array(const char * const string_array[], const char *key); extern int my_query_module(const char *name, int which, void **buf, size_t *bufsize, size_t *ret); diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c index 8961e003e..fc077b309 100644 --- a/libbb/compare_string_array.c +++ b/libbb/compare_string_array.c @@ -17,16 +17,16 @@ #include /* returns the array number of the string */ -extern unsigned short +extern int compare_string_array(const char * const string_array[], const char *key) { - unsigned short i; + int i; for (i = 0; string_array[i] != 0; i++) { if (strcmp(string_array[i], key) == 0) { - break; + return i; } } - return(i); + return -i; } -- 2.25.1