[BusyBox-cvs] busybox/shell ash.c,1.95,1.96

Erik Andersen andersen at busybox.net
Mon Apr 12 19:12:16 UTC 2004


Update of /var/cvs/busybox/shell
In directory nail:/tmp/cvs-serv17626

Modified Files:
	ash.c 
Log Message:
Peter Milne writes:

Just upgraded from 0.6 to 1.00-pre8

Dot command handling handled args correctly (same as bash) in 0.60,
but failed in 1.00:

I fixed this by reverting the dotcmd function back to previous 0.60
instantiation,
please consider using the older version.

Thanks


Peter



Index: ash.c
===================================================================
RCS file: /var/cvs/busybox/shell/ash.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- a/ash.c	7 Apr 2004 09:34:26 -0000	1.95
+++ b/ash.c	12 Apr 2004 19:12:13 -0000	1.96
@@ -8125,21 +8125,40 @@
 	/* NOTREACHED */
 }
 
-int
-dotcmd(int argc, char **argv)
+static int dotcmd(int argc, char **argv)
 {
+	struct strlist *sp;
+	volatile struct shparam saveparam;
+
 	exitstatus = 0;
 
-	if (argc >= 2) {                /* That's what SVR2 does */
+	for (sp = cmdenviron; sp; sp = sp->next)
+		setvareq(bb_xstrdup(sp->text), VSTRFIXED | VTEXTFIXED);
+
+	if (argc >= 2) {	/* That's what SVR2 does */
 		char *fullname;
 		struct stackmark smark;
 
 		setstackmark(&smark);
 		fullname = find_dot_file(argv[1]);
+
+		if (argc > 2) {
+			saveparam = shellparam;
+			shellparam.malloc = 0;
+			shellparam.nparam = argc - 2;
+			shellparam.p = argv + 2;
+		};
+
 		setinputfile(fullname, 1);
 		commandname = fullname;
 		cmdloop(0);
 		popfile();
+
+		if (argc > 2) {
+			freeparam(&shellparam);
+			shellparam = saveparam;
+		};
+
 		popstackmark(&smark);
 	}
 	return exitstatus;




More information about the busybox-cvs mailing list