35 |
|
|
36 |
#ifdef SUPPORT_SERIAL |
#ifdef SUPPORT_SERIAL |
37 |
# include <serial.h> |
# include <serial.h> |
38 |
|
# include <terminfo.h> |
39 |
#endif |
#endif |
40 |
|
|
41 |
#ifdef GRUB_UTIL |
#ifdef GRUB_UTIL |
4142 |
#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */ |
#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */ |
4143 |
|
|
4144 |
|
|
4145 |
|
#ifdef SUPPORT_SERIAL |
4146 |
|
static int |
4147 |
|
terminfo_func (char *arg, int flags) |
4148 |
|
{ |
4149 |
|
struct terminfo term; |
4150 |
|
|
4151 |
|
if (*arg) |
4152 |
|
{ |
4153 |
|
struct |
4154 |
|
{ |
4155 |
|
const char *name; |
4156 |
|
char *var; |
4157 |
|
} |
4158 |
|
options[] = |
4159 |
|
{ |
4160 |
|
{"--name=", term.name}, |
4161 |
|
{"--cursor-address=", term.cursor_address}, |
4162 |
|
{"--clear-screen=", term.clear_screen}, |
4163 |
|
{"--enter-standout-mode=", term.enter_standout_mode}, |
4164 |
|
{"--exit-standout-mode=", term.exit_standout_mode} |
4165 |
|
}; |
4166 |
|
|
4167 |
|
grub_memset (&term, 0, sizeof (term)); |
4168 |
|
|
4169 |
|
while (*arg) |
4170 |
|
{ |
4171 |
|
int i; |
4172 |
|
char *next = skip_to (0, arg); |
4173 |
|
|
4174 |
|
nul_terminate (arg); |
4175 |
|
|
4176 |
|
for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) |
4177 |
|
{ |
4178 |
|
const char *name = options[i].name; |
4179 |
|
int len = grub_strlen (name); |
4180 |
|
|
4181 |
|
if (! grub_memcmp (arg, name, len)) |
4182 |
|
{ |
4183 |
|
grub_strcpy (options[i].var, arg + len); |
4184 |
|
break; |
4185 |
|
} |
4186 |
|
} |
4187 |
|
|
4188 |
|
if (i == sizeof (options) / sizeof (options[0])) |
4189 |
|
{ |
4190 |
|
errnum = ERR_BAD_ARGUMENT; |
4191 |
|
return errnum; |
4192 |
|
} |
4193 |
|
|
4194 |
|
arg = next; |
4195 |
|
} |
4196 |
|
|
4197 |
|
if (term.name[0] == 0 || term.cursor_address[0] == 0) |
4198 |
|
{ |
4199 |
|
errnum = ERR_BAD_ARGUMENT; |
4200 |
|
return errnum; |
4201 |
|
} |
4202 |
|
|
4203 |
|
ti_set_term (term); |
4204 |
|
} |
4205 |
|
else |
4206 |
|
{ |
4207 |
|
/* No option specifies printing out current settings. */ |
4208 |
|
term = ti_get_term (); |
4209 |
|
|
4210 |
|
grub_printf ("name=%s\n", term.name); |
4211 |
|
grub_printf ("cursor_address=%s\n", term.cursor_address); |
4212 |
|
grub_printf ("clear_screen=%s\n", term.clear_screen); |
4213 |
|
grub_printf ("enter_standout_mode=%s\n", term.enter_standout_mode); |
4214 |
|
grub_printf ("exit_standout_mode=%s\n", term.exit_standout_mode); |
4215 |
|
} |
4216 |
|
|
4217 |
|
return 0; |
4218 |
|
} |
4219 |
|
|
4220 |
|
static struct builtin builtin_terminfo = |
4221 |
|
{ |
4222 |
|
"terminfo", |
4223 |
|
terminfo_func, |
4224 |
|
BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, |
4225 |
|
"terminfo [--name=NAME --cursor-address=SEQ [--clear-screen=SEQ]" |
4226 |
|
" [--enter-standout-mode=SEQ] [--exit-standout-mode=SEQ]]", |
4227 |
|
|
4228 |
|
"Define the capabilities of your terminal. Use this command to" |
4229 |
|
" define escape sequences, unless it is vt100-compatible." |
4230 |
|
" You may use \\e for ESC and ^X for a control character." |
4231 |
|
" If no option is specified, the current settings are printed." |
4232 |
|
}; |
4233 |
|
#endif /* SUPPORT_SERIAL */ |
4234 |
|
|
4235 |
|
|
4236 |
/* testload */ |
/* testload */ |
4237 |
static int |
static int |
4238 |
testload_func (char *arg, int flags) |
testload_func (char *arg, int flags) |
4725 |
#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) |
#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) |
4726 |
&builtin_terminal, |
&builtin_terminal, |
4727 |
#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */ |
#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */ |
4728 |
|
#ifdef SUPPORT_SERIAL |
4729 |
|
&builtin_terminfo, |
4730 |
|
#endif /* SUPPORT_SERIAL */ |
4731 |
&builtin_testload, |
&builtin_testload, |
4732 |
&builtin_testvbe, |
&builtin_testvbe, |
4733 |
#ifdef SUPPORT_NETBOOT |
#ifdef SUPPORT_NETBOOT |