diff options
author | Andreas Robinson <andr345@gmail.com> | 2009-04-30 15:21:37 -0400 |
---|---|---|
committer | Jon Masters <jcm@jonmasters.org> | 2009-04-30 15:21:37 -0400 |
commit | 1caeed659e3b3c527f6db3e51211dd727948f98b (patch) | |
tree | 3afcb142a56636487e70b102214a544d847741ce /tables.c | |
parent | e4371e104c39582f1315a70a64e01849685c9ea2 (diff) | |
download | module-init-tools-1caeed659e3b3c527f6db3e51211dd727948f98b.tar.gz |
[PATCH 1/4] Clean up my_basename()
Combines five implementations found in depmod.c, insmod.c, modprobe.c and
util.c. The new version is implemented as a macro.
Signed-off-by: Andreas Robinson <andr345@gmail.com>
Diffstat (limited to 'tables.c')
-rw-r--r-- | tables.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -4,15 +4,16 @@ #include <ctype.h> #include "depmod.h" #include "tables.h" +#include "util.h" /* Turn /lib/modules/2.5.49/kernel/foo.ko(.gz) => foo */ static void make_shortname(char *dest, const char *src) { char *ext; - const char *slash; + const char *bname; - slash = strrchr(src, '/') ?: src-1; - strcpy(dest, slash + 1); + bname = my_basename(src); + strcpy(dest, bname); ext = strchr(dest, '.'); if (ext) *ext = '\0'; |