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

List:       busybox
Subject:    Re: [BusyBox] Applet Hashing for Busybox
From:       Sterling Huxley <sterling () europa ! com>
Date:       2000-10-25 20:23:43
[Download RAW message or body]

To check that the applets[] array is correctly sorted,
add the three lines between the compile (CC) and strip to the Makefile.
I hope I don't have backslash-itis! It works for me, but after emailing...

The awk line gets rid of everything but the applets[] array.
The Sed line gets rid of the #if/endif lines, and changes the {"ar", ar_main..
into a line with only the applet name "ar".
One of the sed exprs is /^[ SPACE TAB ]*$/ to get rid of blank lines.
The Sort line will list ONLY the first line that is out of order.

busybox: $(OBJECTS) 
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBRARIES)

	awk '/applets\[\] = \{/,/\{0,NULL,0,NULL\}/ {print}' $@.c | \
	sed -e '/^#/d' -e '/struct BB_applet/d' -e '/{0,NULL,0,NULL}/d' -e '/^[ 	]*$$/d' -e \
's/^\(.*\"\)\(.*\)\(\",.*\)/\2/' | \  sort -bc

	$(STRIP)


> On Wed Oct 25, 2000 at 06:09:31PM +0100, Gaute B Strokkenes wrote:
> > 
> > > > > BTW, which tools are suitable for doing such a work, SH and c
> > > > > programs certainly,
> > > > 
> > > > Using C would make bb very hard to cross-compile.
> > > 
> > > True!.. and this comes back to previous thing... if one
> > > cross-compiles, forcing to do debug build for simple things may not
> > > be what sometimes is desirable
> > 
> > See above; if you want to cross-compile then you should make sure that
> > you're compiling something that is know to be reasonably bug free.  No
> > one in their right mind will make a largish, arbitrary change (such as
> > adding an applet) and then just cross-compile blindly.
> 
> Agreed.  If someone wanted to, they could add a test that would do some
> sed megic on applets.h, then sort it, run a diff and if diff finds anything
> report an error...  
> 
> That said, I am not too worried; I think the message in applets.h is clear:
> 
> * It is CRUCIAL that this listing be kept in ascii order, otherwise the binary
> * search lookup contributed by Gaute B Strokkenes stops working. If you value
> * your kneecaps, you'll be sure to *make sure* that any changes made to this
> * file result in the listing remaining in ascii order. You have been warned.
> 
> -Erik
> 
> --
> Erik B. Andersen   email:  andersen@lineo.com
> --This message was written using 73% post-consumer electrons--

-- 
Sterling Huxley              sterling@europa.com
Why doesn't my fast forward button work on Reality?


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

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