mirror of https://github.com/ipxe/ipxe.git
Fix spaces-to-tabs
parent
2fe1a387be
commit
3a5cd3640d
|
@ -366,8 +366,8 @@ struct prompt_options {
|
|||
unsigned int key;
|
||||
/** Timeout */
|
||||
unsigned long timeout;
|
||||
/** Set */
|
||||
struct named_setting set;
|
||||
/** Set */
|
||||
struct named_setting set;
|
||||
};
|
||||
|
||||
/** "prompt" option list */
|
||||
|
@ -376,9 +376,9 @@ static struct option_descriptor prompt_opts[] = {
|
|||
struct prompt_options, key, parse_key ),
|
||||
OPTION_DESC ( "timeout", 't', required_argument,
|
||||
struct prompt_options, timeout, parse_timeout ),
|
||||
OPTION_DESC ( "set", 's', required_argument,
|
||||
struct prompt_options, set,
|
||||
parse_autovivified_setting ),
|
||||
OPTION_DESC ( "set", 's', required_argument,
|
||||
struct prompt_options, set,
|
||||
parse_autovivified_setting ),
|
||||
};
|
||||
|
||||
/** "prompt" command descriptor */
|
||||
|
@ -396,7 +396,7 @@ static struct command_descriptor prompt_cmd =
|
|||
static int prompt_exec ( int argc, char **argv ) {
|
||||
struct prompt_options opts;
|
||||
char *text;
|
||||
int key;
|
||||
int key;
|
||||
int rc;
|
||||
|
||||
/* Parse options */
|
||||
|
@ -411,34 +411,34 @@ static int prompt_exec ( int argc, char **argv ) {
|
|||
}
|
||||
|
||||
/* Display prompt and wait for key */
|
||||
key = prompt ( text, opts.timeout );
|
||||
if ( key < 0 ) {
|
||||
rc = key;
|
||||
key = prompt ( text, opts.timeout );
|
||||
if ( key < 0 ) {
|
||||
rc = key;
|
||||
goto err_prompt;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for correct key, if specified */
|
||||
if ( opts.key && ( key != ( ( int ) opts.key ) ) ) {
|
||||
rc = -ECANCELED;
|
||||
goto err_wrong_key;
|
||||
}
|
||||
/* Check for correct key, if specified */
|
||||
if ( opts.key && ( key != ( ( int ) opts.key ) ) ) {
|
||||
rc = -ECANCELED;
|
||||
goto err_wrong_key;
|
||||
}
|
||||
|
||||
/* Store key, if specified */
|
||||
if ( opts.set.settings ) {
|
||||
/* Store key, if specified */
|
||||
if ( opts.set.settings ) {
|
||||
|
||||
/* Apply default type if necessary */
|
||||
if ( ! opts.set.setting.type )
|
||||
opts.set.setting.type = &setting_type_uint16;
|
||||
/* Apply default type if necessary */
|
||||
if ( ! opts.set.setting.type )
|
||||
opts.set.setting.type = &setting_type_uint16;
|
||||
|
||||
/* Store setting */
|
||||
if ( ( rc = storen_setting ( opts.set.settings,
|
||||
&opts.set.setting,
|
||||
key ) ) != 0 ) {
|
||||
printf ( "Could not store \"%s\": %s\n",
|
||||
opts.set.setting.name, strerror ( rc ) );
|
||||
goto err_store;
|
||||
}
|
||||
}
|
||||
/* Store setting */
|
||||
if ( ( rc = storen_setting ( opts.set.settings,
|
||||
&opts.set.setting,
|
||||
key ) ) != 0 ) {
|
||||
printf ( "Could not store \"%s\": %s\n",
|
||||
opts.set.setting.name, strerror ( rc ) );
|
||||
goto err_store;
|
||||
}
|
||||
}
|
||||
|
||||
/* Free prompt text */
|
||||
free ( text );
|
||||
|
|
|
@ -545,7 +545,7 @@ static int autoboot ( void ) {
|
|||
* @ret enter_shell User wants to enter shell
|
||||
*/
|
||||
static int shell_banner ( void ) {
|
||||
int key;
|
||||
int key;
|
||||
|
||||
/* Skip prompt if timeout is zero */
|
||||
if ( BANNER_TIMEOUT <= 0 )
|
||||
|
@ -554,16 +554,16 @@ static int shell_banner ( void ) {
|
|||
/* Prompt user */
|
||||
printf ( "\n" );
|
||||
key = prompt ( "Press Ctrl-B for the " PRODUCT_SHORT_NAME
|
||||
" command line...",
|
||||
( ( BANNER_TIMEOUT * TICKS_PER_SEC ) / 10 ) );
|
||||
if ( key < 0 )
|
||||
return key;
|
||||
" command line...",
|
||||
( ( BANNER_TIMEOUT * TICKS_PER_SEC ) / 10 ) );
|
||||
if ( key < 0 )
|
||||
return key;
|
||||
|
||||
/* Check for correct keypress */
|
||||
if ( key != CTRL_B )
|
||||
return -ECANCELED;
|
||||
/* Check for correct keypress */
|
||||
if ( key != CTRL_B )
|
||||
return -ECANCELED;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
|||
*
|
||||
* Returns success if the specified key was pressed within the
|
||||
* specified timeout period.
|
||||
* @ret key Key pressed, or negative error
|
||||
* @ret key Key pressed, or negative error
|
||||
*/
|
||||
int prompt ( const char *text, unsigned long timeout ) {
|
||||
int key;
|
||||
|
@ -53,7 +53,7 @@ int prompt ( const char *text, unsigned long timeout ) {
|
|||
printf ( "%s", text );
|
||||
|
||||
/* Wait for key */
|
||||
key = getkey ( timeout );
|
||||
key = getkey ( timeout );
|
||||
|
||||
/* Clear the prompt line */
|
||||
while ( *(text++) )
|
||||
|
|
Loading…
Reference in New Issue