mirror of
https://github.com/ipxe/ipxe
synced 2025-12-13 23:41:45 +03:00
settings_ui() now returns a status code.
This commit is contained in:
@@ -11,6 +11,7 @@ extern struct nvo_block *ugly_nvo_hack;
|
|||||||
|
|
||||||
static int config_exec ( int argc, char **argv ) {
|
static int config_exec ( int argc, char **argv ) {
|
||||||
struct config_context dummy_context;
|
struct config_context dummy_context;
|
||||||
|
int rc;
|
||||||
|
|
||||||
if ( argc != 1 ) {
|
if ( argc != 1 ) {
|
||||||
printf ( "Usage: %s\n"
|
printf ( "Usage: %s\n"
|
||||||
@@ -24,7 +25,11 @@ static int config_exec ( int argc, char **argv ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dummy_context.options = ugly_nvo_hack->options;
|
dummy_context.options = ugly_nvo_hack->options;
|
||||||
settings_ui ( &dummy_context );
|
if ( ( rc = settings_ui ( &dummy_context ) ) != 0 ) {
|
||||||
|
printf ( "Could not save settings: %s\n",
|
||||||
|
strerror ( rc ) );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ static void draw_instruction_row ( int editing ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void main_loop ( struct config_context *context ) {
|
static int main_loop ( struct config_context *context ) {
|
||||||
struct setting_widget widget;
|
struct setting_widget widget;
|
||||||
unsigned int current = 0;
|
unsigned int current = 0;
|
||||||
unsigned int next;
|
unsigned int next;
|
||||||
@@ -379,7 +379,7 @@ static void main_loop ( struct config_context *context ) {
|
|||||||
alert ( " Could not save options: %s ",
|
alert ( " Could not save options: %s ",
|
||||||
strerror ( rc ) );
|
strerror ( rc ) );
|
||||||
}
|
}
|
||||||
return;
|
return rc;
|
||||||
default:
|
default:
|
||||||
edit_setting ( &widget, key );
|
edit_setting ( &widget, key );
|
||||||
break;
|
break;
|
||||||
@@ -394,7 +394,9 @@ static void main_loop ( struct config_context *context ) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_ui ( struct config_context *context ) {
|
int settings_ui ( struct config_context *context ) {
|
||||||
|
int rc;
|
||||||
|
|
||||||
initscr();
|
initscr();
|
||||||
start_color();
|
start_color();
|
||||||
init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLUE );
|
init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLUE );
|
||||||
@@ -404,7 +406,9 @@ void settings_ui ( struct config_context *context ) {
|
|||||||
color_set ( CPAIR_NORMAL, NULL );
|
color_set ( CPAIR_NORMAL, NULL );
|
||||||
erase();
|
erase();
|
||||||
|
|
||||||
main_loop ( context );
|
rc = main_loop ( context );
|
||||||
|
|
||||||
endwin();
|
endwin();
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,6 @@
|
|||||||
|
|
||||||
struct config_context;
|
struct config_context;
|
||||||
|
|
||||||
extern void settings_ui ( struct config_context *context );
|
extern int settings_ui ( struct config_context *context );
|
||||||
|
|
||||||
#endif /* _GPXE_SETTINGS_UI_H */
|
#endif /* _GPXE_SETTINGS_UI_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user