summaryrefslogtreecommitdiff
path: root/bin/ksh
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2012-09-05 22:20:26 +0000
committerMarc Espie <espie@cvs.openbsd.org>2012-09-05 22:20:26 +0000
commit8c6b9e8e230d85e9ad4786dfca35e99ec224d204 (patch)
tree78843e7bba6da69f907c13e0c1996125e90dafa3 /bin/ksh
parent00e04ffedcb9bce637bf0eb4ef36bcb0a696c425 (diff)
backout, Todd's version may be cleaner, but it's also wrong.
Diffstat (limited to 'bin/ksh')
-rw-r--r--bin/ksh/main.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/bin/ksh/main.c b/bin/ksh/main.c
index 61dc56799dd..d0714443432 100644
--- a/bin/ksh/main.c
+++ b/bin/ksh/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.48 2012/09/05 22:15:29 espie Exp $ */
+/* $OpenBSD: main.c,v 1.49 2012/09/05 22:20:25 espie Exp $ */
/*
* startup, main loop, environments and error handling
@@ -67,23 +67,6 @@ char username[_PW_NAME_LEN + 1];
#define version_param (initcoms[2])
-/* modifying argv will modify ps output, so sh -c needs to copy part of it
- * to be able to parse further options
- */
-static char **
-copy_argv(int argc, char *argv[])
-{
- int i;
- char **nargv;
-
- nargv = alloc(sizeof(char *) * (argc + 1), &aperm);
- nargv[0] = (char *) kshname;
- for (i = 1; i < argc; i++)
- nargv[i] = argv[i];
- nargv[i] = NULL;
- return nargv;
-}
-
int
main(int argc, char *argv[])
{
@@ -331,8 +314,9 @@ main(int argc, char *argv[])
#endif
l = e->loc;
+ l->argv = &argv[argi - 1];
l->argc = argc - argi;
- l->argv = copy_argv(l->argc, &argv[argi - 1]);
+ l->argv[0] = (char *) kshname;
getopts_reset(1);
/* Disable during .profile/ENV reading */