summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-08-27 13:24:16 +0000
committerOlivier Blin <oblin@mandriva.com>2007-08-27 13:24:16 +0000
commite54fedfd85f1b8e680f4fb036b70c51706054076 (patch)
tree2657faf95d086dac06fa7b36f2d94a4919f2f080 /mdk-stage1
parenta146b05787110bce5a6f47d40cbca3f8b4f822ab (diff)
downloaddrakx-backup-do-not-use-e54fedfd85f1b8e680f4fb036b70c51706054076.tar
drakx-backup-do-not-use-e54fedfd85f1b8e680f4fb036b70c51706054076.tar.gz
drakx-backup-do-not-use-e54fedfd85f1b8e680f4fb036b70c51706054076.tar.bz2
drakx-backup-do-not-use-e54fedfd85f1b8e680f4fb036b70c51706054076.tar.xz
drakx-backup-do-not-use-e54fedfd85f1b8e680f4fb036b70c51706054076.zip
extract filename2modname() function
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/modules.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index 92cae21ba..ce61b3f01 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -86,6 +86,17 @@ static char *kernel_module_extension(void)
return ".ko.gz";
}
+
+static char * filename2modname(char * filename) {
+ char * modname = strdup(filename);
+ while (modname && *modname) {
+ if (*modname == '-')
+ *modname = '_';
+ modname++;
+ }
+ return modname;
+}
+
static int load_modules_dependencies(void)
{
char * deps_file = "/modules/modules.dep";
@@ -104,7 +115,6 @@ static int load_modules_dependencies(void)
line = 0;
while (start < (buf+s.st_size) && *start) {
char * tmp_deps[50];
- char * modp;
end = strchr(start, '\n');
*end = '\0';
@@ -121,14 +131,7 @@ static int load_modules_dependencies(void)
/* sort of a good line */
modules_deps[line].filename = strdup(start);
-
- modules_deps[line].modname = strdup(start);
- modp = modules_deps[line].modname;
- while (modp && *modp) {
- if (*modp == '-')
- *modp = '_';
- modp++;
- }
+ modules_deps[line].modname = filename2modname(start);
start = ptr;
i = 0;