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
 
11
 
12
 static int config_exec ( int argc, char **argv ) {
12
 static int config_exec ( int argc, char **argv ) {
13
 	struct config_context dummy_context;
13
 	struct config_context dummy_context;
14
+	int rc;
14
 
15
 
15
 	if ( argc != 1 ) {
16
 	if ( argc != 1 ) {
16
 		printf ( "Usage: %s\n"
17
 		printf ( "Usage: %s\n"
24
 	}
25
 	}
25
 
26
 
26
 	dummy_context.options = ugly_nvo_hack->options;
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
 	return 0;
34
 	return 0;
30
 }
35
 }

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

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
 	struct setting_widget widget;
322
 	struct setting_widget widget;
323
 	unsigned int current = 0;
323
 	unsigned int current = 0;
324
 	unsigned int next;
324
 	unsigned int next;
379
 					alert ( " Could not save options: %s ",
379
 					alert ( " Could not save options: %s ",
380
 						strerror ( rc ) );
380
 						strerror ( rc ) );
381
 				}
381
 				}
382
-				return;
382
+				return rc;
383
 			default:
383
 			default:
384
 				edit_setting ( &widget, key );
384
 				edit_setting ( &widget, key );
385
 				break;
385
 				break;
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
 	initscr();
400
 	initscr();
399
 	start_color();
401
 	start_color();
400
 	init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLUE );
402
 	init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLUE );
404
 	color_set ( CPAIR_NORMAL, NULL );
406
 	color_set ( CPAIR_NORMAL, NULL );
405
 	erase();
407
 	erase();
406
 	
408
 	
407
-	main_loop ( context );
409
+	rc = main_loop ( context );
408
 
410
 
409
 	endwin();
411
 	endwin();
412
+
413
+	return rc;
410
 }
414
 }

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

9
 
9
 
10
 struct config_context;
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
 #endif /* _GPXE_SETTINGS_UI_H */
14
 #endif /* _GPXE_SETTINGS_UI_H */

Loading…
Cancel
Save