summaryrefslogtreecommitdiff
path: root/usr.sbin/crunchgen/crunched_main.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2015-12-06 12:00:17 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2015-12-06 12:00:17 +0000
commitfa781fc376a73a5fd66733de6d5f4f7078af5b97 (patch)
treeb7447c66b23c25dc7404a82c2b0478e2436553db /usr.sbin/crunchgen/crunched_main.c
parente33812ae9ddd39e9387b8268ca681862956458ac (diff)
Use __progname instead of manually handling argv[0].
ok deraadt, mmcc, tedu
Diffstat (limited to 'usr.sbin/crunchgen/crunched_main.c')
-rw-r--r--usr.sbin/crunchgen/crunched_main.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.sbin/crunchgen/crunched_main.c b/usr.sbin/crunchgen/crunched_main.c
index c3f1ad0cb03..8c4095e9ae2 100644
--- a/usr.sbin/crunchgen/crunched_main.c
+++ b/usr.sbin/crunchgen/crunched_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crunched_main.c,v 1.4 2014/01/11 04:43:00 deraadt Exp $ */
+/* $OpenBSD: crunched_main.c,v 1.5 2015/12/06 12:00:16 tobias Exp $ */
/*
* Copyright (c) 1994 University of Maryland
@@ -47,22 +47,19 @@ extern struct stub entry_points[];
int
main(int argc, char *argv[], char **envp)
{
- char *slash, *basename;
+ extern char *__progname;
struct stub *ep;
- if (argv[0] == NULL || *argv[0] == '\0')
+ if (__progname == NULL || *__progname == '\0')
crunched_usage();
- slash = strrchr(argv[0], '/');
- basename = slash ? slash + 1 : argv[0];
-
for (ep = entry_points; ep->name != NULL; ep++)
- if (!strcmp(basename, ep->name))
+ if (!strcmp(__progname, ep->name))
break;
if (ep->name)
return ep->f(argc, argv, envp);
- fprintf(stderr, "%s: %s not compiled in\n", EXECNAME, basename);
+ fprintf(stderr, "%s: %s not compiled in\n", EXECNAME, __progname);
crunched_usage();
}