More bbsh design notes.

Rob Landley rob at landley.net
Tue Sep 12 19:01:19 UTC 2006


On Tuesday 12 September 2006 6:11 am, Ian Oliver wrote:
> > I've been working on terminal control today.  (Ok, in reality I just spent 
a 
> > couple hours helping make slides for upper management about a source 
control 
> > migration proposal, and now I'm catching up on my email, but I'm _trying_ 
to 
> > work on terminal control for bbsh.)
> 
> Command line editing and completion?

Not yet.  Right now it's letting the tty handle all the editing.  I've got 
CONFIG options for editing, tab completion, and tilde completion, but I've 
got a dozen unimplemented config options already and I'm adding more as I 
consolidate various design notes.

> I guess I should just pull it out with svn  
> and have a look around.

We've got nightly snapshots too.  http://busybox.net/downloads/snapshots

> > Well, right now it does simple scripting, but doesn't have any actual flow 
> > control or pipes.  I'll probably do pipes next, which covers parsing | || 
& 
> > && > >> < << ; and ().  Flow control covers if, for, while, and function 
> > definitions with curly brackets.
> 
> Give me && and goto and I'll just pretend it's Fortran. :)

Shells do goto?  (Checks susv3 "Shell command language" page...  Search 
for "goto" not found.  Checks bash man page...  Does not include the 
word "goto".)  Apparently not.

Thinking for a moment, implementing goto would suck because you'd have to 
treat the entire shell script as a big function and from a memory usage 
standpoint that would just be evil...

> > > They have then switched to hacking udhcpc/script.c  
> > > to remove the script calling and directly add the calls to ifconfig and 
> > > generation of smb.conf !!!!
> > 
> > *shrug*  If the script doesn't exist, or returns 0, the dhcp client should 
> > call ifconfig and route, and write resolv.conf.
> 
> I'm just not sure how many systems would be able to make use of this simple 
> default behaviour. Still, it can be configed out ...

Well, my laptop could.

And the shell returning 0 would mean it wouldn't have to call ifconfig, route, 
or write resolve.conf.  It could veto it by returning 1 (or do it itself), 
and the dhcp client wouldn't do this until _after_ the script returned, so if 
you wanted to add firewall rules before the interface went up, you could.  
Does tweaking the samba config files care whether the interface is already up 
yet?  I suppose there could be .before and .after versions of scripts (call 
system() twice with slightly different names), I'd have to look at what it 
was currently doing (and if there are any standards in the area) to see what 
would make sense there...

And yeah, it could be a CONFIG option.

> > Well, shell/bbsh.c is in svn already.  It's not in the config system but 
you 
> > can build it my doing a make defconfig && make and then 
> > running "scripts/individual bbsh".  That'll create build/bbsh as a 
standalone 
> > executable.
> 
> OK, I'll have a play. I can also see if any of the other applets I'm using 
are 
> fixed (or broken!) on uClinux.

I happily take patches.  This is an area in which I have interest, but not 
time.

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list