summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>2000-04-26 23:22:39 +0000
committerErik Troan <ewt@redhat.com>2000-04-26 23:22:39 +0000
commitad6042cadfc532aa6c74321fa7d667e86bf6b1ea (patch)
treec54c0ef061c6b110a6f3f638725fe9dbf9e1cc4b
parentce8350187cf960b73fe8ed41aaf1f861f6d6ec48 (diff)
downloadanaconda-ad6042cadfc532aa6c74321fa7d667e86bf6b1ea.tar.gz
anaconda-ad6042cadfc532aa6c74321fa7d667e86bf6b1ea.tar.xz
anaconda-ad6042cadfc532aa6c74321fa7d667e86bf6b1ea.zip
merge module info files based on module name
-rw-r--r--isys/moduleinfo.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/isys/moduleinfo.c b/isys/moduleinfo.c
index 5e38f91c6..b40e93652 100644
--- a/isys/moduleinfo.c
+++ b/isys/moduleinfo.c
@@ -42,7 +42,7 @@ struct moduleInfo * isysFindModuleInfo(moduleInfoSet mis,
if (!strcmp(moduleName, mis->moduleList[i].moduleName)) {
if (!found)
found = mis->moduleList + i;
- else if (found->path && !mis->moduleList[i].path)
+ else if (found->locationID && !mis->moduleList[i].locationID)
;
else
found = mis->moduleList + i;
@@ -57,13 +57,14 @@ moduleInfoSet isysNewModuleInfoSet(void) {
}
int isysReadModuleInfo(const char * filename, moduleInfoSet mis,
- char * modPath) {
+ char * ident) {
int fd, isIndented;
char * buf, * start, * next, * chptr;
struct stat sb;
char oldch;
struct moduleInfo * nextModule;
int modulesAlloced;
+ int i;
fd = open(filename, O_RDONLY);
if (fd < 0) return -1;
@@ -102,22 +103,36 @@ int isysReadModuleInfo(const char * filename, moduleInfoSet mis,
if (*start != '\n' && *start && *start != '#') {
if (!isIndented) {
- if (nextModule && nextModule->moduleName) mis->numModules++;
+ if (nextModule && nextModule->moduleName &&
+ nextModule == (mis->moduleList + mis->numModules))
+ mis->numModules++;
if (mis->numModules == modulesAlloced) {
modulesAlloced += 5;
mis->moduleList = realloc(mis->moduleList,
modulesAlloced * sizeof(*mis->moduleList));
}
- nextModule = mis->moduleList + mis->numModules;
- nextModule->moduleName = strdup(start);
- nextModule->major = DRIVER_NONE;
- nextModule->minor = DRIVER_MINOR_NONE;
- nextModule->description = NULL;
- nextModule->flags = 0;
- nextModule->args = NULL;
- nextModule->numArgs = 0;
- nextModule->path = modPath;
+
+ nextModule = NULL;
+ for (i = 0; i < mis->numModules; i++) {
+ if (!strcmp(mis->mods[i]->name, start) {
+ nextModule = mis->mods[i];
+ break;
+ }
+ }
+
+ if (!nextModule) {
+ nextModule = mis->moduleList + mis->numModules;
+
+ nextModule->moduleName = strdup(start);
+ nextModule->major = DRIVER_NONE;
+ nextModule->minor = DRIVER_MINOR_NONE;
+ nextModule->description = NULL;
+ nextModule->flags = 0;
+ nextModule->args = NULL;
+ nextModule->numArgs = 0;
+ nextModule->locationID = ident;
+ }
} else if (!nextModule) {
/* ACK! syntax error */
return 1;