summaryrefslogtreecommitdiffhomepage
path: root/editors/awk.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-01-07 14:39:34 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-01-07 14:39:34 +0100
commit844a6c5abdcb5a189e91cb7ca3742bcaed25a4da (patch)
tree8cf5e90d42a9c45fec0e87692d2c170bdf97a549 /editors/awk.c
parent9c8e94bc0a3836dd6b8acbcf1fa88283a0a3c148 (diff)
awk: code shrink
function old new delta awk_main 955 948 -7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors/awk.c')
-rw-r--r--editors/awk.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 8f523ea28..d54249bfd 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -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)
+int awk_main(int argc UNUSED_PARAM, char **argv)
{
unsigned opt;
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);
argv += optind;
- argc -= optind;
+ //argc -= optind;
if (opt & OPT_W)
bb_error_msg("warning: option -W is ignored");
if (opt & OPT_F) {
@@ -3255,15 +3255,14 @@ int awk_main(int argc, char **argv)
if (!*argv)
bb_show_usage();
parse_program(*argv++);
- argc--;
}
/* fill in ARGV array */
- setvar_i(intvar[ARGC], argc + 1);
setari_u(intvar[ARGV], 0, "awk");
i = 0;
while (*argv)
setari_u(intvar[ARGV], ++i, *argv++);
+ setvar_i(intvar[ARGC], i + 1);
evaluate(beginseq.first, &tv);
if (!mainseq.first && !endseq.first)