Browse Source

settings_ui() now returns a status code.

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
cbeec25662
3 changed files with 15 additions and 6 deletions
  1. 6
    1
      src/hci/commands/config_cmd.c
  2. 8
    4
      src/hci/tui/settings_ui.c
  3. 1
    1
      src/include/gpxe/settings_ui.h

+ 6
- 1
src/hci/commands/config_cmd.c View File

@@ -11,6 +11,7 @@ extern struct nvo_block *ugly_nvo_hack;
11 11
 
12 12
 static int config_exec ( int argc, char **argv ) {
13 13
 	struct config_context dummy_context;
14
+	int rc;
14 15
 
15 16
 	if ( argc != 1 ) {
16 17
 		printf ( "Usage: %s\n"
@@ -24,7 +25,11 @@ static int config_exec ( int argc, char **argv ) {
24 25
 	}
25 26
 
26 27
 	dummy_context.options = ugly_nvo_hack->options;
27
-	settings_ui ( &dummy_context );
28
+	if ( ( rc = settings_ui ( &dummy_context ) ) != 0 ) {
29
+		printf ( "Could not save settings: %s\n",
30
+			 strerror ( rc ) );
31
+		return 1;
32
+	}
28 33
 
29 34
 	return 0;
30 35
 }

+ 8
- 4
src/hci/tui/settings_ui.c View File

@@ -318,7 +318,7 @@ static void draw_instruction_row ( int editing ) {
318 318
 	}
319 319
 }
320 320
 
321
-static void main_loop ( struct config_context *context ) {
321
+static int main_loop ( struct config_context *context ) {
322 322
 	struct setting_widget widget;
323 323
 	unsigned int current = 0;
324 324
 	unsigned int next;
@@ -379,7 +379,7 @@ static void main_loop ( struct config_context *context ) {
379 379
 					alert ( " Could not save options: %s ",
380 380
 						strerror ( rc ) );
381 381
 				}
382
-				return;
382
+				return rc;
383 383
 			default:
384 384
 				edit_setting ( &widget, key );
385 385
 				break;
@@ -394,7 +394,9 @@ static void main_loop ( struct config_context *context ) {
394 394
 	
395 395
 }
396 396
 
397
-void settings_ui ( struct config_context *context ) {
397
+int settings_ui ( struct config_context *context ) {
398
+	int rc;
399
+
398 400
 	initscr();
399 401
 	start_color();
400 402
 	init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLUE );
@@ -404,7 +406,9 @@ void settings_ui ( struct config_context *context ) {
404 406
 	color_set ( CPAIR_NORMAL, NULL );
405 407
 	erase();
406 408
 	
407
-	main_loop ( context );
409
+	rc = main_loop ( context );
408 410
 
409 411
 	endwin();
412
+
413
+	return rc;
410 414
 }

+ 1
- 1
src/include/gpxe/settings_ui.h View File

@@ -9,6 +9,6 @@
9 9
 
10 10
 struct config_context;
11 11
 
12
-extern void settings_ui ( struct config_context *context );
12
+extern int settings_ui ( struct config_context *context );
13 13
 
14 14
 #endif /* _GPXE_SETTINGS_UI_H */

Loading…
Cancel
Save