npc(1): tweak OpenBSD functions
This commit is contained in:
parent
10b7f7706b
commit
da190f713c
20
src/npc.c
20
src/npc.c
@ -39,22 +39,20 @@ usage(char *argv0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
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;
|
int c;
|
||||||
char showend = 0; /* print a dollar sign before each newline */
|
char showend = 0; /* print a dollar sign before each newline */
|
||||||
char showtab = 0; /* prints tab characters in caret notation */
|
char showtab = 0; /* prints tab characters in caret notation */
|
||||||
|
|
||||||
if (argc > 0) {
|
#ifdef __OpenBSD__
|
||||||
#ifndef __OpenBSD__
|
if (pledge("stdio", NULL) == -1) {
|
||||||
program_name = argv[0];
|
perror(argv[0] == NULL ? program_name : argv[0]);
|
||||||
|
return EX_OSERR;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (argc > 0) {
|
||||||
|
program_name = argv[0];
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "et")) != -1) {
|
while ((c = getopt(argc, argv, "et")) != -1) {
|
||||||
switch (c){
|
switch (c){
|
||||||
case 'e': showend = 1; break;
|
case 'e': showend = 1; break;
|
||||||
|
Loading…
Reference in New Issue
Block a user