diff options
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/expr.c b/src/expr.c index ce65ecf46..2331f64fe 100644 --- a/src/expr.c +++ b/src/expr.c @@ -312,15 +312,17 @@ main (int argc, char **argv) parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION, usage, AUTHORS, (char const *) NULL); + /* The above handles --help and --version. Since there is no other invocation of getopt, handle `--' here. */ - if (argc > 1 && STREQ (argv[1], "--")) + unsigned int u_argc = argc; + if (1 < u_argc && STREQ (argv[1], "--")) { - --argc; + --u_argc; ++argv; } - if (argc <= 1) + if (u_argc <= 1) { error (0, 0, _("missing operand")); usage (EXPR_INVALID); |