diff options
Diffstat (limited to 'games')
-rw-r--r-- | games/caesar/caesar.c | 11 | ||||
-rw-r--r-- | games/hack/hack.end.c | 6 | ||||
-rw-r--r-- | games/hack/hack.main.c | 7 | ||||
-rw-r--r-- | games/hunt/huntd/driver.c | 8 |
4 files changed, 13 insertions, 19 deletions
diff --git a/games/caesar/caesar.c b/games/caesar/caesar.c index 22acb6c6dee..0266b1c57a2 100644 --- a/games/caesar/caesar.c +++ b/games/caesar/caesar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: caesar.c,v 1.17 2015/10/14 08:12:12 doug Exp $ */ +/* $OpenBSD: caesar.c,v 1.18 2015/12/16 14:21:50 tb Exp $ */ /* * Copyright (c) 1989, 1993 @@ -69,7 +69,8 @@ int main(int argc, char *argv[]) { int ch, i, nread; - char *inbuf, *p, **av; + extern char *__progname; + char *inbuf; int obs[26], try, winner; double dot, winnerdot; @@ -77,11 +78,7 @@ main(int argc, char *argv[]) err(1, "pledge"); /* check to see if we were called as rot13 */ - av = argv; - p = strrchr(*av, '/'); - if (p++ == NULL) - p = *av; - if (strcmp(p,"rot13") == 0) + if (strcmp(__progname, "rot13") == 0) printit(13); if (argc > 1) { diff --git a/games/hack/hack.end.c b/games/hack/hack.end.c index 32b60a67fe3..559904d1c51 100644 --- a/games/hack/hack.end.c +++ b/games/hack/hack.end.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.end.c,v 1.13 2015/10/24 18:26:13 mmcc Exp $ */ +/* $OpenBSD: hack.end.c,v 1.14 2015/12/16 14:21:50 tb Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -613,7 +613,7 @@ charcat(char *s, char c) void prscore(int argc, char **argv) { - extern char *hname; + extern char *__progname; char **players; int playerct; int rank; @@ -699,7 +699,7 @@ prscore(int argc, char **argv) if(playerct > 1) printf("any of "); for(i=0; i<playerct; i++) printf("%s%s", players[i], (i<playerct-1)?", ":".\n"); - printf("Call is: %s -s [playernames]\n", hname); + printf("Call is: %s -s [playernames]\n", __progname); } } return; diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c index ca58f8ec830..abf079b1a50 100644 --- a/games/hack/hack.main.c +++ b/games/hack/hack.main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hack.main.c,v 1.18 2015/11/04 21:22:10 tedu Exp $ */ +/* $OpenBSD: hack.main.c,v 1.19 2015/12/16 14:21:50 tb Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -90,7 +90,6 @@ int locknum; /* max num of players */ char *catmore; /* default pager */ #endif char SAVEF[PL_NSIZ + 11] = "save/"; /* save/99999player */ -char *hname; /* name of the game (argv[0] of call) */ char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */ extern char *nomovemsg; @@ -103,12 +102,12 @@ static void chdirx(char *, boolean); int main(int argc, char **argv) { + extern char *__progname; int fd; #ifdef CHDIR char *dir; #endif - hname = argv[0]; hackpid = getpid(); #ifdef CHDIR /* otherwise no chdir() */ @@ -187,7 +186,7 @@ main(int argc, char **argv) * Find the creation date of this game, * so as to avoid restoring outdated savefiles. */ - gethdate(hname); + gethdate(__progname); /* * We cannot do chdir earlier, otherwise gethdate will fail. diff --git a/games/hunt/huntd/driver.c b/games/hunt/huntd/driver.c index f46b71acbc1..19060ecffb7 100644 --- a/games/hunt/huntd/driver.c +++ b/games/hunt/huntd/driver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: driver.c,v 1.22 2015/09/25 17:50:53 schwarze Exp $ */ +/* $OpenBSD: driver.c,v 1.23 2015/12/16 14:21:50 tb Exp $ */ /* $NetBSD: driver.c,v 1.5 1997/10/20 00:37:16 lukem Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -52,7 +52,6 @@ #include "conf.h" #include "server.h" -char *First_arg; /* pointer to argv[0] */ u_int16_t Server_port; int Server_socket; /* test socket to answer datagrams */ FLAG should_announce = TRUE; /* true if listening on standard port */ @@ -88,6 +87,7 @@ main(ac, av) static FLAG server = FALSE; extern int optind; extern char *optarg; + extern char *__progname; int c; static struct timeval linger = { 0, 0 }; static struct timeval timeout = { 0, 0 }, *to; @@ -97,8 +97,6 @@ main(ac, av) int fd; int background = 0; - First_arg = av[0]; - config(); while ((c = getopt(ac, av, "bsp:a:D:")) != -1) { @@ -127,7 +125,7 @@ erred: fprintf(stderr, "usage: %s [-bs] [-a addr] [-D var=value] " "[-p port]\n", - av[0]); + __progname); exit(2); } } |