diff options
Diffstat (limited to 'findutils')
| -rw-r--r-- | findutils/find.c | 4 | ||||
| -rw-r--r-- | findutils/grep.c | 10 |
2 files changed, 6 insertions, 8 deletions
diff --git a/findutils/find.c b/findutils/find.c index 76cd18c1a..1b2466816 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
| @@ -835,7 +835,7 @@ static action*** parse_params(char **argv) | |||
| 835 | 835 | ||
| 836 | 836 | ||
| 837 | int find_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 837 | int find_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| 838 | int find_main(int argc, char **argv) | 838 | int find_main(int argc UNUSED_PARAM, char **argv) |
| 839 | { | 839 | { |
| 840 | static const char options[] ALIGN1 = | 840 | static const char options[] ALIGN1 = |
| 841 | "-follow\0" | 841 | "-follow\0" |
| @@ -859,7 +859,7 @@ IF_FEATURE_FIND_MAXDEPTH(OPT_MINDEPTH,) | |||
| 859 | 859 | ||
| 860 | INIT_G(); | 860 | INIT_G(); |
| 861 | 861 | ||
| 862 | for (firstopt = 1; firstopt < argc; firstopt++) { | 862 | for (firstopt = 1; argv[firstopt]; firstopt++) { |
| 863 | if (argv[firstopt][0] == '-') | 863 | if (argv[firstopt][0] == '-') |
| 864 | break; | 864 | break; |
| 865 | if (ENABLE_FEATURE_FIND_NOT && LONE_CHAR(argv[firstopt], '!')) | 865 | if (ENABLE_FEATURE_FIND_NOT && LONE_CHAR(argv[firstopt], '!')) |
diff --git a/findutils/grep.c b/findutils/grep.c index 9dc2f1942..193b48c11 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
| @@ -519,7 +519,7 @@ static int grep_dir(const char *dir) | |||
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | int grep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 521 | int grep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| 522 | int grep_main(int argc, char **argv) | 522 | int grep_main(int argc UNUSED_PARAM, char **argv) |
| 523 | { | 523 | { |
| 524 | FILE *file; | 524 | FILE *file; |
| 525 | int matched; | 525 | int matched; |
| @@ -606,7 +606,6 @@ int grep_main(int argc, char **argv) | |||
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | argv += optind; | 608 | argv += optind; |
| 609 | argc -= optind; | ||
| 610 | 609 | ||
| 611 | /* if we didn't get a pattern from -e and no command file was specified, | 610 | /* if we didn't get a pattern from -e and no command file was specified, |
| 612 | * first parameter should be the pattern. no pattern, no worky */ | 611 | * first parameter should be the pattern. no pattern, no worky */ |
| @@ -616,12 +615,11 @@ int grep_main(int argc, char **argv) | |||
| 616 | bb_show_usage(); | 615 | bb_show_usage(); |
| 617 | pattern = new_grep_list_data(*argv++, 0); | 616 | pattern = new_grep_list_data(*argv++, 0); |
| 618 | llist_add_to(&pattern_head, pattern); | 617 | llist_add_to(&pattern_head, pattern); |
| 619 | argc--; | ||
| 620 | } | 618 | } |
| 621 | 619 | ||
| 622 | /* argv[0..(argc-1)] should be names of file to grep through. If | 620 | /* argv[0..(argc-1)] should be names of file to grep through. If |
| 623 | * there is more than one file to grep, we will print the filenames. */ | 621 | * there is more than one file to grep, we will print the filenames. */ |
| 624 | if (argc > 1) | 622 | if (argv[0] && argv[1]) |
| 625 | print_filename = 1; | 623 | print_filename = 1; |
| 626 | /* -H / -h of course override */ | 624 | /* -H / -h of course override */ |
| 627 | if (option_mask32 & OPT_H) | 625 | if (option_mask32 & OPT_H) |
| @@ -633,7 +631,7 @@ int grep_main(int argc, char **argv) | |||
| 633 | * stdin. Otherwise, we grep through all the files specified. */ | 631 | * stdin. Otherwise, we grep through all the files specified. */ |
| 634 | matched = 0; | 632 | matched = 0; |
| 635 | do { | 633 | do { |
| 636 | cur_file = *argv++; | 634 | cur_file = *argv; |
| 637 | file = stdin; | 635 | file = stdin; |
| 638 | if (!cur_file || LONE_DASH(cur_file)) { | 636 | if (!cur_file || LONE_DASH(cur_file)) { |
| 639 | cur_file = "(standard input)"; | 637 | cur_file = "(standard input)"; |
| @@ -659,7 +657,7 @@ int grep_main(int argc, char **argv) | |||
| 659 | matched += grep_file(file); | 657 | matched += grep_file(file); |
| 660 | fclose_if_not_stdin(file); | 658 | fclose_if_not_stdin(file); |
| 661 | grep_done: ; | 659 | grep_done: ; |
| 662 | } while (--argc > 0); | 660 | } while (*argv && *++argv); |
| 663 | 661 | ||
| 664 | /* destroy all the elments in the pattern list */ | 662 | /* destroy all the elments in the pattern list */ |
| 665 | if (ENABLE_FEATURE_CLEAN_UP) { | 663 | if (ENABLE_FEATURE_CLEAN_UP) { |
