config_cmd.c

Go to the documentation of this file.
00001 #include <string.h>
00002 #include <stdio.h>
00003 #include <gpxe/command.h>
00004 #include <gpxe/settings.h>
00005 #include <gpxe/settings_ui.h>
00006 
00007 FILE_LICENCE ( GPL2_OR_LATER );
00008 
00009 static int config_exec ( int argc, char **argv ) {
00010         char *settings_name;
00011         struct settings *settings;
00012         int rc;
00013 
00014         if ( argc > 2 ) {
00015                 printf ( "Usage: %s [scope]\n"
00016                          "Opens the option configuration console\n", argv[0] );
00017                 return 1;
00018         }
00019 
00020         settings_name = ( ( argc == 2 ) ? argv[1] : "" );
00021         settings = find_settings ( settings_name );
00022         if ( ! settings ) {
00023                 printf ( "No such scope \"%s\"\n", settings_name );
00024                 return 1;
00025         }
00026 
00027         if ( ( rc = settings_ui ( settings ) ) != 0 ) {
00028                 printf ( "Could not save settings: %s\n",
00029                          strerror ( rc ) );
00030                 return 1;
00031         }
00032 
00033         return 0;
00034 }
00035 
00036 struct command config_command __command = {
00037         .name = "config",
00038         .exec = config_exec,
00039 };

Generated on Tue Apr 6 20:01:06 2010 for gPXE by  doxygen 1.5.7.1