Add envp argument support to crunchgen.

Even though envp is not the POSIX way of crawling through the environment,
this will hopefully save someone from having to scratch their head
really hard with a crunched program using envp.

from henric@aimnet.com, via OpenBSD
This commit is contained in:
pooka 2002-07-03 12:45:06 +00:00
parent 2bd3a8cf3c
commit d395d11df0
1 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: crunched_main.c,v 1.2 1997/08/02 21:30:10 perry Exp $ */
/* $NetBSD: crunched_main.c,v 1.3 2002/07/03 12:45:06 pooka Exp $ */
/*
* Copyright (c) 1994 University of Maryland
* All Rights Reserved.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: crunched_main.c,v 1.2 1997/08/02 21:30:10 perry Exp $");
__RCSID("$NetBSD: crunched_main.c,v 1.3 2002/07/03 12:45:06 pooka Exp $");
#endif
#include <stdio.h>
@ -47,7 +47,7 @@ struct stub {
extern struct stub entry_points[];
int main(int argc, char **argv)
int main(int argc, char **argv, char **envp)
{
char *slash, *basename;
struct stub *ep;
@ -62,7 +62,7 @@ int main(int argc, char **argv)
if(!strcmp(basename, ep->name)) break;
if(ep->name)
return ep->f(argc, argv);
return ep->f(argc, argv, envp);
else {
fprintf(stderr, "%s: %s not compiled in\n", EXECNAME, basename);
crunched_usage();
@ -70,7 +70,7 @@ int main(int argc, char **argv)
}
int crunched_main(int argc, char **argv)
int crunched_main(int argc, char **argv, char **envp)
{
struct stub *ep;
int columns, len;
@ -78,7 +78,7 @@ int crunched_main(int argc, char **argv)
if(argc <= 1)
crunched_usage();
return main(--argc, ++argv);
return main(--argc, ++argv, envp);
}