[BusyBox] Bourne parser update
Erik Andersen
andersen at lineo.com
Thu Jan 4 11:49:00 UTC 2001
On Tue Jan 02, 2001 at 11:12:03PM -0800, larry at doolittle.boa.org wrote:
> I posted yet another snapshot of parser.c. It now has a proper web page, see
> http://doolittle.faludi.com/~larry/parser.html
>
> Hey, hey! This version is actually capable of running programs!
> It still has some major bugs, of course. The source file size
> is growing, but the executable size is still nicely contained:
> 11536 bytes on my system. Not bad for a program that understands
> parameter expansion (properly!), command substitution, redirects,
> subshells, command lists (&, ;, &&, ||), quoting, globbing, word
> splitting, and quote removal.
Cool. BTW, a bug showed up in my sh.c variant of parser.c when
execing the shell via a script. Turns out '#' chars (and the
stuff that follows them )are getting parsed and executed.
parse_stream() needs this to behave itself wrt '#':
-if (m==0 || ((m==1 || m==2) && dest->quote)) {
+if ((m==0 && ch != '#') || ((m==1 || m==2) && dest->quote)) {
as well as an
+} else if (m==0 && ch == '#') {
+ while(ch=b_getch(input,0),ch!=EOF && ch!='\n');
I have placed a copy of my current sh.c on http://codepoet.org/sh.c (which is
the latest parser.c plus handling for handling 'sh -c', running things as a
shell script, as well as including an interactive mode with full command line
editing. Scripts work fine. Something is broken at the moment with interactive
mode though (apps don't get run).
-Erik
--
Erik B. Andersen email: andersen at lineo.com
--This message was written using 73% post-consumer electrons--
More information about the busybox
mailing list