strcmp(1): further error-proofing
This commit is contained in:
parent
98c4d94f6d
commit
4c81516742
12
src/strcmp.c
12
src/strcmp.c
@ -26,18 +26,22 @@
|
||||
char *program_name = "strcmp";
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
program_name = argv[0] == NULL ? program_name : argv[0];
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
if (pledge("stdio", NULL) == -1) {
|
||||
perror(program_name);
|
||||
perror(argv[0] == NULL ? program_name : argv[0]);
|
||||
|
||||
return EX_OSERR;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (argc < 3) {
|
||||
(void)fprintf(stderr, "Usage: %s string string...\n", program_name);
|
||||
(void)fprintf(
|
||||
stderr,
|
||||
"Usage: %s string string...\n",
|
||||
argv[0] == NULL ? program_name : argv[0]
|
||||
);
|
||||
|
||||
return EX_USAGE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user