[BusyBox] two busybox 0.60.5 patches (insmod/modprobe)

Cam Mayor cmayor at iders.ca
Mon Sep 22 22:38:15 UTC 2003


On Monday 22 September 2003 16:31, Manuel Novoa III wrote:
> Hello,
>
> On Mon, Sep 22, 2003 at 03:50:05PM -0500, Cam Mayor wrote:
> > In modprobe, i added the function int isblank (int c), which is a GNU
> > extension, but not part of standard C.
>
> Actually, isblank() is ANSI/ISO C99.  You need to update your
> documentation.

Perhaps.  My documentation on this came from ctype.h on arm-linux-gcc 2.95.3, 
which _does_ have 
#ifdef  __USE_ISOC99
__exctype (isblank);
#endif
although i am apparently not configured to use it.  (ie. __USE_ISOC99 not def)
Also, my standard source of C/C++ library reference is dinkumware, which does 
not list isblank() in ctype.h.  
http://www.dinkumware.com/manuals/reader.aspx?b=p/&h=ctype.html
(you may not be able to surf directly to this link)

Nonetheless, my compiler(s) barfed on it.  I cannot easily change my 
compilers at the moment without affecting a larger supply and versioning 
control chain of events.  Therefore it is easier to code around it.  I 
thought some others may be in the same boat.  Here is a fix for them.  As i 
said, everybody else is welcome to discard it or do whatever they want with 
it.  Anybody not using C99 is welcome to use the fcn i coded for busybox.

> > +char *basename(char *path)
> > +{
> > +       char * foundloc = strchr(path, '/');
> > +       if (NULL == foundloc)
> > +               return path;
> > +       else
> > +               return basename(++foundloc);
> > +}
> > +
>
> Uh... ok... I'm _almost_ speechless.  Why on earth would you want to
> use recursion here?  Take a look at strrchr().

*shrug* I don't manipulate strings often (usually just numbers and objects).  
Strrchr seems more appropriate to use now that you point at it, but this is a 
trivial case for recursion and works fine as advertised.  Some say that i 
like recursion.  I'd say it, but i always precede that statement with a 
disclaimer that i like recursion, so it winds up taking a while.

> Out of curiosity, which compilers and C libraries are you using?

arm-linux-gcc/++/etc 2.95.3
binutils 2.11
plus another arm cross compiler version of gcc 2.95.3 compiled to use a 
uClibc snapshot from Aug 10, 2001

cheers,
cam

-- 
Cameron Mayor
Iders Incorporated
600A Clifton Street
Winnipeg, MB Canada R3G 2X6
http://www.iders.ca



More information about the busybox mailing list