[PATCH] shell/lash.c: set environment variable
Rob Landley
rob at landley.net
Tue Jun 13 12:02:27 PDT 2006
On Friday 05 May 2006 9:35 pm, Shaun Jackman wrote:
> Ping! Any comments?
>
> Cheers,
> Shaun
>
> On 4/21/06, Shaun Jackman <sjackman at gmail.com> wrote:
> > This patch allows setting an environment variable without an explicit
> > `export' statement. I understand there's a moratorium of features on
> > lash, but I consider 'foo=bar' a fairly basic and necessary syntax. On
> > my ARM7 system this patch adds 32 bytes to the .text section.
> >
> > Cheers,
> > Shaun
> >
> > 2006-04-21 Shaun Jackman <sjackman at gmail.com>
> >
> > * shell/lash.c (pseudo_exec): Allow setting an environment
> > variable without an explicit 'export'.
> >
> > --- shell/lash.c 2b6a5734121d4cecda4cd49e644666a1c7bff365
> > +++ shell/lash.c a4e70a7df8005ac54581bc78f626b770c85ee767
> > @@ -1233,6 +1233,12 @@
> > char *name;
> > #endif
> >
> > + /* Check if the command sets an environment variable. */
> > + if( strchr(child->argv[0], '=') != NULL ) {
> > + child->argv[1] = child->argv[0];
> > + _exit(builtin_export(child));
> > + }
> > +
> > /* Check if the command matches any of the non-forking builtins.
> > * Depending on context, this might be redundant. But it's
> > * easier to waste a few CPU cycles than it is to figure out
Ok, svn 15378. I shrank enough from lash with the previous checkin that I
didn't feel guilty about adding one more feature. :)
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list