summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2007-03-29 13:56:49 +0000
committerBernhard Reutner-Fischer2007-03-29 13:56:49 +0000
commita87ed2c716d883d7665904d3716a63e21337c6cf (patch)
tree5b1f5fd6407cd4eb5ca2900c43cfeacf2d1d6728
parent307d27df4fae76445708378561fb6f91ed70d76b (diff)
downloadbusybox-a87ed2c716d883d7665904d3716a63e21337c6cf.zip
busybox-a87ed2c716d883d7665904d3716a63e21337c6cf.tar.gz
- use index_in_str_array also for find_main
text data bss dec hex filename 2605 1 12 2618 a3a find.o.r18274 2602 1 12 2615 a37 find.o.r18275
-rw-r--r--findutils/find.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/findutils/find.c b/findutils/find.c
index f94bd23..a4fe5d1 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -646,6 +646,11 @@ int find_main(int argc, char **argv)
char *arg;
char **argp;
int i, firstopt, status = EXIT_SUCCESS;
+ const char * const options[] = {
+ "-follow",
+USE_FEATURE_FIND_XDEV( "-xdev", )
+ NULL
+ };
for (firstopt = 1; firstopt < argc; firstopt++) {
if (argv[firstopt][0] == '-')
@@ -672,12 +677,13 @@ int find_main(int argc, char **argv)
/* (-a will be ignored by recursive parser later) */
argp = &argv[firstopt];
while ((arg = argp[0])) {
- if (strcmp(arg, "-follow") == 0) {
+ i = index_in_str_array(options, arg);
+ if (i == 0) { /* -follow */
dereference = TRUE;
argp[0] = (char*)"-a";
}
#if ENABLE_FEATURE_FIND_XDEV
- else if (strcmp(arg, "-xdev") == 0) {
+ else if (i == 1) { /* -xdev */
struct stat stbuf;
if (!xdev_count) {
xdev_count = firstopt - 1;