diff --git a/src/npc.c b/src/npc.c index 5b6c5c9..cd488e5 100644 --- a/src/npc.c +++ b/src/npc.c @@ -39,22 +39,20 @@ usage(char *argv0) { } int main(int argc, char *argv[]) { -#ifdef __OpenBSD__ - program_name = argv[0] == NULL ? program_name : argv[0]; - - if (pledge("stdio", NULL) == -1) { - perror(program_name); - return EX_OSERR; - } -#endif int c; char showend = 0; /* print a dollar sign before each newline */ char showtab = 0; /* prints tab characters in caret notation */ - if (argc > 0) { -#ifndef __OpenBSD__ - program_name = argv[0]; +#ifdef __OpenBSD__ + if (pledge("stdio", NULL) == -1) { + perror(argv[0] == NULL ? program_name : argv[0]); + return EX_OSERR; + } #endif + + if (argc > 0) { + program_name = argv[0]; + while ((c = getopt(argc, argv, "et")) != -1) { switch (c){ case 'e': showend = 1; break;