diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-05-20 01:28:44 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-05-20 01:28:44 +0000 |
commit | 38435d8d807781175be775f4cb1b51e0805a1c1d (patch) | |
tree | 2107c05d473cd492574a08a1490c6292ec13a04d /usr.sbin/crunchgen | |
parent | 094a646be0a10d5ee7de094165c21d487bf8c4e2 (diff) |
Restore support for 'instbin program args...'
problem noted by and ok deraadt@
Diffstat (limited to 'usr.sbin/crunchgen')
-rw-r--r-- | usr.sbin/crunchgen/crunched_main.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/usr.sbin/crunchgen/crunched_main.c b/usr.sbin/crunchgen/crunched_main.c index 8c4095e9ae2..42e5b774549 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.5 2015/12/06 12:00:16 tobias Exp $ */ +/* $OpenBSD: crunched_main.c,v 1.6 2016/05/20 01:28:43 guenther Exp $ */ /* * Copyright (c) 1994 University of Maryland @@ -44,35 +44,38 @@ struct stub { extern struct stub entry_points[]; -int -main(int argc, char *argv[], char **envp) +static int +crunched_main2(char *progname, int argc, char **argv, char **envp) { - extern char *__progname; struct stub *ep; - if (__progname == NULL || *__progname == '\0') + if (progname == NULL || *progname == '\0') crunched_usage(); for (ep = entry_points; ep->name != NULL; ep++) - if (!strcmp(__progname, 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, __progname); + fprintf(stderr, "%s: %s not compiled in\n", EXECNAME, progname); crunched_usage(); } int -crunched_main(int argc, char **argv, char **envp) +main(int argc, char *argv[], char **envp) { - struct stub *ep; - int columns, len; + extern char *__progname; + return crunched_main2(__progname, argc, argv, envp); +} + +int +crunched_main(int argc, char **argv, char **envp) +{ if (argc <= 1) crunched_usage(); - - return main(--argc, ++argv, envp); + return crunched_main2(argv[1], argc-1, argv+1, envp); } int |