summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-06-20 13:24:14 +0000
committerJim Meyering <jim@meyering.net>1994-06-20 13:24:14 +0000
commit3a3b00cc54c2dad4ab3bea5fdc81e06f467b5846 (patch)
treeff81d2c7f96f140b349cb43e773b04dbd6d6d7f8
parent0d3ba947f3ac2b3bb803c8f09a3c1027dffb43e3 (diff)
downloadcoreutils-3a3b00cc54c2dad4ab3bea5fdc81e06f467b5846.tar.xz
.
-rw-r--r--src/nice.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/nice.c b/src/nice.c
index d0db40018..814b81737 100644
--- a/src/nice.c
+++ b/src/nice.c
@@ -80,35 +80,29 @@ main (argc, argv)
program_name = argv[0];
- /* Inhibit the error message getopt would otherwise give for
- unrecognized options. */
- opterr = 0;
-
while ((optc = getopt_long (argc, argv, "+0123456789-n:", longopts,
(int *) 0)) != EOF)
{
char *s;
+ /* Determine whether this is an option like `--5'.
+ If so, treat it like `-n -5'. */
+ s = argv[optind];
+ /* Make sure s[1..] is a valid negative integer.
+ Test/convert `s+1' rather than `s+2' so we reject options
+ like `---5' as unrecognized. */
+ if (s[0] == '-' && s[1] == '-' && isinteger (s + 1))
+ {
+ adjustment = atoi (s + 1);
+ adjustment_given = 1;
+ ++optind;
+ continue;
+ }
+
switch (optc)
{
case '?':
- /* Determine whether this is an option like `--5'.
- If so, treat it like `-n -5'. */
- s = argv[optind - 1];
- /* Make sure s[1..] is a valid negative integer.
- Test/convert `s+1' rather than `s+2' so we reject options
- like `---5' as unrecognized. */
- if (s[1] == '-' && isinteger (s + 1))
- {
- adjustment = atoi (s + 1);
- adjustment_given = 1;
- }
- else
- {
- error (0, 0, "unrecognized option `%s'", s);
- usage (1);
- }
- break;
+ usage (1);
case 0:
break;