8 * Standard version of load_config for extlinux/syslinux filesystems.
10 * This searches for extlinux.conf and syslinux.cfg in the install
11 * directory, followed by a set of fallback directories. If found,
12 * set the current working directory to match.
14 int generic_load_config(void)
16 static const char *search_directories
[] = {
17 NULL
, /* CurrentDirName */
23 static const char *filenames
[] = {
31 search_directories
[0] = CurrentDirName
;
33 dprintf("CurrentDirName: \"%s\"\n", CurrentDirName
);
35 for (i
= *CurrentDirName
? 0 : 1; search_directories
[i
]; i
++) {
36 const char *sd
= search_directories
[i
];
37 for (j
= 0; filenames
[j
]; j
++) {
38 memset(®s
, 0, sizeof regs
);
39 snprintf(ConfigName
, FILENAME_MAX
, "%s%s%s",
40 sd
, (*sd
&& sd
[strlen(sd
)-1] == '/') ? "" : "/",
42 regs
.edi
.w
[0] = OFFS_WRT(ConfigName
, 0);
43 dprintf("Config search: %s\n", ConfigName
);
44 call16(core_open
, ®s
, ®s
);
45 if (!(regs
.eflags
.l
& EFLAGS_ZF
)) {
46 chdir(search_directories
[i
]);
47 return 0; /* Got it */