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

Cam Mayor cmayor at iders.ca
Mon Sep 22 20:50:05 UTC 2003


Hi all,

I am not currently subscribed to the busybox mailing list.  (hence will not 
see replies not CC'd to me)  However, in getting version 0.60.5 to run on my 
system, i had to add two functions; one to insmod and the other to modprobe.  
both functions are duplications of functions available on some, but not all, 
systems.

In insmod, i added the function char *basename(char *path), which originally 
comes from libgen.h.  One compiler i need to use does not have that library.

In modprobe, i added the function int isblank (int c), which is a GNU 
extension, but not part of standard C.

Both are included here in unified format.  Use them in good health or discard 
them as you see fit.  Both (trivial) functions are written by me on behalf of 
my company, and can be considered GPLd.

cheers,
cam

diff -urN -X /home/users/cmayor/cvstools/dontdiff busybox-0.60.5/insmod.c 
busybox/insmod.c
--- busybox-0.60.5/insmod.c     Mon Sep 16 00:30:10 2002
+++ busybox/insmod.c    Fri Sep 19 14:21:05 2003
@@ -186,6 +186,20 @@
 #endif
 
 //--------------------------------------------------------------------------
+//--basename - return a pointer to the basename (man 3 basename)
+//     cmayor at iders.ca, 2003
+//     --this could be turned into an applet for busybox - see applets.h
+//--------------------------------------------------------------------------
+char *basename(char *path)
+{
+       char * foundloc = strchr(path, '/');
+       if (NULL == foundloc)
+               return path;
+       else
+               return basename(++foundloc);
+}
+
+//----------------------------------------------------------------------------
 //--------modutils module.h, lines 45-242
 //---------------------------------------------------------------------------



diff -urN -X /home/users/cmayor/cvstools/dontdiff busybox-0.60.5/modprobe.c 
busybox/modprobe.c
--- busybox-0.60.5/modprobe.c   Wed Sep 18 10:07:05 2002
+++ busybox/modprobe.c  Fri Sep 19 14:30:09 2003
@@ -55,6 +55,20 @@
        struct dep_t * m_next;
 };
 
+/************************************************
+* Had to create this for my compiler.  isblank() is a GNU extension,
+* not a C standard library function. (from ctype.h)
+       The values returned are nonzero if the character c falls into
+          the tested class, and a zero value if not.
+************************************************/
+int isblank (int c)
+{
+       if (' ' == c || '\t' == c)
+               return c;
+       else
+               return 0;
+}
+
 
 static struct dep_t *build_dep ( void )
 {

--
Cameron Mayor
Iders Incorporated
600A Clifton Street
Winnipeg, MB Canada R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 29
fax: 204-779-5444



More information about the busybox mailing list