aboutsummaryrefslogtreecommitdiffstats
path: root/core/fs/lib/loadconfig.c
blob: d84bdef9e0364b217a6b9622b8dab3792fb2e29d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <dprintf.h>
#include <stdio.h>
#include <string.h>
#include <core.h>
#include <fs.h>

/*
 * Standard version of load_config for extlinux/syslinux filesystems
 */
int generic_load_config(void)
{
    com32sys_t regs;

    chdir(CurrentDirName);
    /* try extlinux.conf first */
    realpath(ConfigName, "extlinux.conf", FILENAME_MAX);
    dprintf("Try config = %s\n", ConfigName);
    memset(&regs, 0, sizeof regs);
    regs.edi.w[0] = OFFS_WRT(ConfigName, 0);
    call16(core_open, &regs, &regs);
    /* give syslinux.cfg a chance ? */
    if (regs.eflags.l & EFLAGS_ZF) {
	realpath(ConfigName, "syslinux.cfg", FILENAME_MAX);
	dprintf("Then try config = %s\n", ConfigName);
	memset(&regs, 0, sizeof regs);
	regs.edi.w[0] = OFFS_WRT(ConfigName, 0);
	call16(core_open, &regs, &regs);
    }
    return (regs.eflags.l & EFLAGS_ZF) ? -1 : 0;
}