aboutsummaryrefslogtreecommitdiffstats
path: root/tables.c
diff options
context:
space:
mode:
authorAndreas Robinson <andr345@gmail.com>2009-04-30 15:21:37 -0400
committerJon Masters <jcm@jonmasters.org>2009-04-30 15:21:37 -0400
commit1caeed659e3b3c527f6db3e51211dd727948f98b (patch)
tree3afcb142a56636487e70b102214a544d847741ce /tables.c
parente4371e104c39582f1315a70a64e01849685c9ea2 (diff)
downloadmodule-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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tables.c b/tables.c
index 1dccaf3..e3f005f 100644
--- a/tables.c
+++ b/tables.c
@@ -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';