49#include <sys/reboot.h>
53#define SETENV(k, v) kern_setenv(k, v)
54#define GETENV(k) kern_getenv(k)
55#define FREE(v) freeenv(v)
57#define SETENV(k, v) setenv(k, v, 1)
58#define GETENV(k) getenv(k)
67 {
"boot_askname", RB_ASKNAME},
68 {
"boot_cdrom", RB_CDROM},
69 {
"boot_ddb", RB_KDB},
70 {
"boot_dfltroot", RB_DFLTROOT},
71 {
"boot_gdb", RB_GDB},
72 {
"boot_multicons", RB_MULTIPLE},
73 {
"boot_mute", RB_MUTE},
74 {
"boot_pause", RB_PAUSE},
75 {
"boot_serial", RB_SERIAL},
76 {
"boot_single", RB_SINGLE},
77 {
"boot_verbose", RB_VERBOSE},
98 for (howto = 0, i = 0;
howto_names[i].ev != NULL; i++) {
100 if (val != NULL && strcasecmp(val,
"no") != 0)
135static const char howto_switches[] =
"aCdrgDmphsv";
136static int howto_masks[] = {
137 RB_ASKNAME, RB_CDROM, RB_KDB, RB_DFLTROOT, RB_GDB, RB_MULTIPLE,
138 RB_MUTE, RB_PAUSE, RB_SERIAL, RB_SINGLE, RB_VERBOSE
141 opts = strchr(kargs,
'-');
142 while (opts != NULL) {
143 while (*(++opts) !=
'\0') {
144 sw = strchr(howto_switches, *opts);
147 howto |= howto_masks[sw - howto_switches];
149 opts = strchr(opts,
'-');
157 case 'a': howto |= RB_ASKNAME;
break;
158 case 'C': howto |= RB_CDROM;
break;
159 case 'd': howto |= RB_KDB;
break;
160 case 'D': howto |= RB_MULTIPLE;
break;
161 case 'm': howto |= RB_MUTE;
break;
162 case 'g': howto |= RB_GDB;
break;
163 case 'h': howto |= RB_SERIAL;
break;
164 case 'p': howto |= RB_PAUSE;
break;
165 case 'P': howto |= RB_PROBE;
break;
166 case 'r': howto |= RB_DFLTROOT;
break;
167 case 's': howto |= RB_SINGLE;
break;
168 case 'S':
SETENV(
"comconsole_speed", v + 1); v += strlen(v);
break;
169 case 'v': howto |= RB_VERBOSE;
break;
193 while ((v = strsep(&cmdline, delim)) != NULL) {
220 for (i = 1; i < argc; i++)
int boot_parse_cmdline_delim(char *cmdline, const char *delim)
breakup the command line into args, and pass to boot_parse_arg
void boot_howto_to_env(int howto)
Set env vars from howto_names based on howto passed in.
int boot_parse_arg(char *v)
Helper routine to parse a single arg and return its mask.
int boot_env_to_howto(void)
convert the env vars in howto_names into a howto mask
static struct @9 howto_names[]
int boot_parse_args(int argc, char *argv[])
Pass a vector of strings to boot_parse_arg.
int boot_parse_cmdline(char *cmdline)
Simplified interface for common 'space or tab separated' args.