diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2010-06-23 16:31:45 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-06-23 16:33:28 -0700 |
commit | 2e8b89f8b2d711a1689067834113483610fa18cd (patch) | |
tree | 76d4691a58d3f5aa0bf9ea2c49624b2744dd07d3 /libinstaller | |
parent | 3ee5120d0795b361c3548e9bb13cadf33802f73a (diff) | |
download | syslinux-2e8b89f8b2d711a1689067834113483610fa18cd.tar.gz |
Move modify_adv() into common code
modify_adv() should be used by any installer which uses the common
CLI, so it should go into syslxopt.c.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'libinstaller')
-rw-r--r-- | libinstaller/syslxopt.c | 29 | ||||
-rw-r--r-- | libinstaller/syslxopt.h | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/libinstaller/syslxopt.c b/libinstaller/syslxopt.c index 9fda16d0..0ff2efbb 100644 --- a/libinstaller/syslxopt.c +++ b/libinstaller/syslxopt.c @@ -20,6 +20,7 @@ #include <stdlib.h> #include <stddef.h> #include <stdint.h> +#include <string.h> #include <getopt.h> #include <sysexits.h> #include "../version.h" @@ -206,3 +207,31 @@ void parse_options(int argc, char *argv[], enum syslinux_mode mode) if (argv[optind]) usage(EX_USAGE, mode); /* Excess arguments */ } + +/* + * Make any user-specified ADV modifications in memory + */ +int modify_adv(void) +{ + int rv = 0; + + if (opt.reset_adv) + syslinux_reset_adv(syslinux_adv); + + if (opt.set_once) { + if (syslinux_setadv(ADV_BOOTONCE, strlen(opt.set_once), opt.set_once)) { + fprintf(stderr, "%s: not enough space for boot-once command\n", + program); + rv = -1; + } + } + if (opt.menu_save) { + if (syslinux_setadv(ADV_MENUSAVE, strlen(opt.menu_save), opt.menu_save)) { + fprintf(stderr, "%s: not enough space for menu-save label\n", + program); + rv = -1; + } + } + + return rv; +} diff --git a/libinstaller/syslxopt.h b/libinstaller/syslxopt.h index ba60ce2f..446ab9af 100644 --- a/libinstaller/syslxopt.h +++ b/libinstaller/syslxopt.h @@ -29,6 +29,7 @@ enum syslinux_mode { void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode); void parse_options(int argc, char *argv[], enum syslinux_mode mode); +int modify_adv(void); extern struct sys_options opt; extern const struct option long_options[]; |