intcmp(1): move program_name ternary
This commit is contained in:
parent
6b9d13b8a0
commit
338a3e7155
12
src/intcmp.c
12
src/intcmp.c
@ -46,20 +46,20 @@ int main(int argc, char *argv[]) {
|
|||||||
int r; /* reference integer */
|
int r; /* reference integer */
|
||||||
mode = 0;
|
mode = 0;
|
||||||
|
|
||||||
program_name = (argv[0] == NULL ? program_name : argv[0]);
|
if (argc < 3) {
|
||||||
|
return usage(argv[0] == NULL ? program_name : argv[0]);
|
||||||
if (argc == 0) { return usage(program_name); }
|
}
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "egl")) != -1) {
|
while ((c = getopt(argc, argv, "egl")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'e': mode |= EQUAL; break;
|
case 'e': mode |= EQUAL; break;
|
||||||
case 'g': mode |= GREATER; break;
|
case 'g': mode |= GREATER; break;
|
||||||
case 'l': mode |= LESSER; 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;
|
i = optind;
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ int main(int argc, char *argv[]) {
|
|||||||
fprintf(
|
fprintf(
|
||||||
stderr,
|
stderr,
|
||||||
"%s: argument #%d: Invalid integer\n",
|
"%s: argument #%d: Invalid integer\n",
|
||||||
program_name,
|
argv[0],
|
||||||
(int)i
|
(int)i
|
||||||
);
|
);
|
||||||
return EX_USAGE;
|
return EX_USAGE;
|
||||||
|
Loading…
Reference in New Issue
Block a user