intcmp(1): move program_name ternary

This commit is contained in:
Emma Tebibyte 2024-07-28 18:31:01 -06:00
parent 6b9d13b8a0
commit 338a3e7155
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -46,20 +46,20 @@ int main(int argc, char *argv[]) {
int r; /* reference integer */
mode = 0;
program_name = (argv[0] == NULL ? program_name : argv[0]);
if (argc == 0) { return usage(program_name); }
if (argc < 3) {
return usage(argv[0] == NULL ? program_name : argv[0]);
}
while ((c = getopt(argc, argv, "egl")) != -1) {
switch (c) {
case 'e': mode |= EQUAL; break;
case 'g': mode |= GREATER; break;
case 'l': mode |= LESSER; break;
default: return usage(program_name);
default: return usage(argv[0]);
}
}
if (optind + 2 /* ref cmp */ > argc) { return usage(program_name); }
if (optind + 2 /* ref cmp */ > argc) { return usage(argv[0]); }
i = optind;
@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
fprintf(
stderr,
"%s: argument #%d: Invalid integer\n",
program_name,
argv[0],
(int)i
);
return EX_USAGE;