diff options
author | tb <tb@cvs.openbsd.org> | 2015-12-16 14:16:28 +0000 |
---|---|---|
committer | tb <tb@cvs.openbsd.org> | 2015-12-16 14:16:28 +0000 |
commit | 441d1d864cdb230c088aa9df3c4405cbcf309bbe (patch) | |
tree | f714c6b7ca84b71e6ffb23ed6e698ab4de0d2612 /games | |
parent | a871aacd4cf995adfc8682ff476665f1ed5a83b1 (diff) |
Use __progname instead of hand-rolled parsing of argv[0].
Inspired by similar diffs by tobias@ and millert@.
"I like the concept" pjanzen@
ok tedu@
Diffstat (limited to 'games')
-rw-r--r-- | games/sail/main.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/games/sail/main.c b/games/sail/main.c index 1eb65f9564b..756bf23927f 100644 --- a/games/sail/main.c +++ b/games/sail/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.8 2014/03/11 07:42:55 guenther Exp $ */ +/* $OpenBSD: main.c,v 1.9 2015/12/16 14:16:27 tb Exp $ */ /* $NetBSD: main.c,v 1.3 1995/04/22 10:37:01 cgd Exp $ */ /* @@ -43,6 +43,7 @@ main(argc, argv) int argc; char **argv; { + extern char *__progname; char *p; int i; int fd; @@ -56,10 +57,7 @@ main(argc, argv) exit(1); close(fd); - if ((p = strrchr(*argv, '/'))) - p++; - else - p = *argv; + p = __progname; if (strcmp(p, "driver") == 0 || strcmp(p, "saildriver") == 0) mode = MODE_DRIVER; else if (strcmp(p, "sail.log") == 0) |