aboutsummaryrefslogtreecommitdiffstats
path: root/core/fs/lib/loadconfig.c
blob: d164ae132901e02995cb069b37935e62120de106 (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
31
32
33
34
35
36
37
38
39
#include <dprintf.h>
#include <stdio.h>
#include <string.h>
#include <core.h>
#include <fs.h>

/*
 * Standard version of load_config for extlinux/syslinux filesystems.
 *
 * This searches for extlinux.conf and syslinux.cfg in the install
 * directory, followed by a set of fallback directories.  If found,
 * set the current working directory to match.
 */
int generic_open_config(struct com32_filedata *filedata)
{
    static const char *search_directories[] = {
	NULL,			/* CurrentDirName */
	"/boot/syslinux",
	"/syslinux",
	"/",
	NULL
    };
    static const char *filenames[] = {
	"extlinux.conf",
#if defined(__FIRMWARE_EFI64__)
	"syslx64.cfg",
#elif defined(__FIRMWARE_EFI32__)
	"syslia32.cfg",
#endif
	"syslinux.cfg",
	NULL
    };

    search_directories[0] = CurrentDirName;

    dprintf("CurrentDirName: \"%s\"\n", CurrentDirName);

    return search_dirs(filedata, search_directories, filenames, ConfigName);
}