1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-18 01:40:06 +02:00

(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/.
This commit is contained in:
Jim Meyering
2000-06-20 06:46:28 +00:00
parent 700b4bde5e
commit b1c4d0148a

View File

@@ -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;
}