awk: code shrink

function                                             old     new   delta
awk_main                                             955     948      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-01-07 14:39:34 +01:00
parent 9c8e94bc0a
commit 844a6c5abd

View File

@ -3149,7 +3149,7 @@ static rstream *next_input_file(void)
} }
int awk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int awk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int awk_main(int argc, char **argv) int awk_main(int argc UNUSED_PARAM, char **argv)
{ {
unsigned opt; unsigned opt;
char *opt_F; char *opt_F;
@ -3218,7 +3218,7 @@ int awk_main(int argc, char **argv)
} }
opt = getopt32(argv, OPTSTR_AWK, &opt_F, &list_v, &list_f, IF_FEATURE_AWK_GNU_EXTENSIONS(&list_e,) NULL); opt = getopt32(argv, OPTSTR_AWK, &opt_F, &list_v, &list_f, IF_FEATURE_AWK_GNU_EXTENSIONS(&list_e,) NULL);
argv += optind; argv += optind;
argc -= optind; //argc -= optind;
if (opt & OPT_W) if (opt & OPT_W)
bb_error_msg("warning: option -W is ignored"); bb_error_msg("warning: option -W is ignored");
if (opt & OPT_F) { if (opt & OPT_F) {
@ -3255,15 +3255,14 @@ int awk_main(int argc, char **argv)
if (!*argv) if (!*argv)
bb_show_usage(); bb_show_usage();
parse_program(*argv++); parse_program(*argv++);
argc--;
} }
/* fill in ARGV array */ /* fill in ARGV array */
setvar_i(intvar[ARGC], argc + 1);
setari_u(intvar[ARGV], 0, "awk"); setari_u(intvar[ARGV], 0, "awk");
i = 0; i = 0;
while (*argv) while (*argv)
setari_u(intvar[ARGV], ++i, *argv++); setari_u(intvar[ARGV], ++i, *argv++);
setvar_i(intvar[ARGC], i + 1);
evaluate(beginseq.first, &tv); evaluate(beginseq.first, &tv);
if (!mainseq.first && !endseq.first) if (!mainseq.first && !endseq.first)