summaryrefslogtreecommitdiffstats
path: root/contrib/syslinux-4.02/core/fs/newconfig.c
blob: 58c47a51f34e2fe847913411776b98115cfdc7b1 (plain) (blame)
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
40
41
/* ----------------------------------------------------------------------- *
 *
 *   Copyright 2010 Intel Corporation; author: H. Peter Anvin
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 *   Boston MA 02110-1301, USA; either version 2 of the License, or
 *   (at your option) any later version; incorporated herein by reference.
 *
 * ----------------------------------------------------------------------- */

/*
 * newconfig.c
 *
 * Load a new configuration file
 */

#include "core.h"
#include "fs.h"

void pm_is_config_file(com32sys_t *regs)
{
    char target_cwd[FILENAME_MAX];
    const char *p;

    (void)regs;

    /* Save configuration file as an absolute path for posterity */
    realpath(ConfigName, KernelName, FILENAME_MAX);

    /* If we got anything on the command line, do a chdir */
    p = cmd_line;
    while (*p && !not_whitespace(*p))
	p++;

    if (*p) {
	mangle_name(target_cwd, p);
	chdir(target_cwd);
    }
}