Exit status fixes.

Previously help and all usage errors resulted in exit status 255, which
is unconventional.

Treat help as non-error, and error with status 2 for usage errors to
match more common command behavior.

The exit status of -? changes to that of an usage error, even though it
is listed as one of the help invoking options, due to getopt_long
behavior.
This commit is contained in:
Ville Skyttä 2021-08-29 10:32:15 +03:00
parent 465afe830f
commit 8aaf5be82a

7
main.c
View file

@ -409,9 +409,9 @@ int main(int argc, char *argv[])
control->flags |= FLAG_FORCE_REPLACE;
break;
case 'h':
case '?':
usage(compat);
return -1;
exit(0);
break;
case 'H':
control->flags |= FLAG_HASH;
break;
@ -544,6 +544,9 @@ int main(int argc, char *argv[])
case '9':
control->compression_level = c - '0';
break;
default:
usage(compat);
return 2;
}
}