[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] lash, environment variables, and wordexp
From:       Larry Doolittle <ldoolitt () recycle ! lbl ! gov>
Date:       2000-11-27 20:29:41
[Download RAW message or body]

I noticed in glibc-2.1.2/posix/wordexp.c you can find
99% of the solution to BusyBox's lash variable problems,
all GPL'd and ready to go.  The prototype is

int wordexp (const char *words, wordexp_t *pwordexp, int flags);

My suggestions follow.  I will follow up on them at my normal
tortoise-like pace, unless some hare passes me by :-)

1. Rework sh.c to use wordexp(), and adapt wordexp.c to
   make a few more automatic variables work right (like $?).

2. Write an lean, lite implementation of wordexp() for inclusion
   in BusyBox, uClibc, and/or newlib.  Many people probably
   would be unhappy with the glibc all-singing, all-dancing
   version, whose stripped object file weighs in around 20kBytes.
   
3. Clean up and generalize the glibc wordexp.c hacks, and
   push them upstream to the glibc maintainers.  For those
   applications where glibc is already needed, this routine
   then comes "for free" in terms of executable image size.

If you want a quick look at that code, and don't have a glibc
source tree unpacked in a handly location, you can look at
 <a href="http://recycle.lbl.gov/~ldoolitt/wordexp.h">wordexp.h</a> and
 <a href="http://recycle.lbl.gov/~ldoolitt/wordexp.c">wordexp.c</a>.
They have some nice looking test routines, too, which I haven't tried.

        - Larry Doolittle   <LRDoolittle@lbl.gov>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic