aboutsummaryrefslogtreecommitdiff
path: root/findutils/grep.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-04 14:15:38 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-04 14:15:38 +0100
commit2ec91aead52d6ea6a42420005119ebb281a76cdc (patch)
tree115804c56ff172f96c0138bcabcc7d5e56e5dae0 /findutils/grep.c
parenta355da07756e529c112249653ed5af0e2d910728 (diff)
downloadbusybox-w32-2ec91aead52d6ea6a42420005119ebb281a76cdc.tar.gz
busybox-w32-2ec91aead52d6ea6a42420005119ebb281a76cdc.tar.bz2
busybox-w32-2ec91aead52d6ea6a42420005119ebb281a76cdc.zip
*: remove some uses of argc
function old new delta whoami_main 34 37 +3 logname_main 60 63 +3 hostid_main 35 38 +3 ttysize_main 136 135 -1 nmeter_main 673 672 -1 logger_main 387 386 -1 uuencode_main 330 328 -2 ifupdown_main 2125 2123 -2 mesg_main 158 155 -3 free_main 333 330 -3 cal_main 902 899 -3 acpid_main 443 440 -3 ar_main 196 189 -7 find_main 476 467 -9 ifconfig_main 1235 1221 -14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/12 up/down: 9/-49) Total: -40 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'findutils/grep.c')
-rw-r--r--findutils/grep.c10
1 files changed, 4 insertions, 6 deletions
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
521int grep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 521int grep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
522int grep_main(int argc, char **argv) 522int 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) {