From: Jim Meyering Date: Tue, 20 Jun 2000 06:46:28 +0000 (+0000) Subject: (main): Fix off-by-argc test, so +N-style options are recognized once again. X-Git-Tag: FILEUTILS-4_0v~64 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=b1c4d0148a36e3688efe33a9fe56bcba4eba1c8d;p=thirdparty%2Fcoreutils.git (main): Fix off-by-argc test, so +N-style options are recognized once again. Reported by Geoff Keunning. Fix typo in diagnostic: s/compare/skip/. --- diff --git a/src/uniq.c b/src/uniq.c index fa0fa0e5f1..12964a0303 100644 --- a/src/uniq.c +++ b/src/uniq.c @@ -428,7 +428,7 @@ main (int argc, char **argv) } } - if (optind >= 2 && !STREQ (argv[optind - 1], "--")) + if (argc - optind >= 2 && !STREQ (argv[optind - 1], "--")) { /* Interpret non-option arguments with leading `+' only if we haven't seen `--'. */ @@ -439,7 +439,7 @@ main (int argc, char **argv) if (xstrtol (opt_str, NULL, 10, &tmp_long, "") != LONGINT_OK || tmp_long <= 0 || tmp_long > INT_MAX) error (EXIT_FAILURE, 0, - _("invalid number of bytes to compare: `%s'"), + _("invalid number of bytes to skip: `%s'"), opt_str); skip_chars = (int) tmp_long; }