You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config_cmd.c 782B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <gpxe/command.h>
  4. #include <gpxe/settings.h>
  5. #include <gpxe/settings_ui.h>
  6. static int config_exec ( int argc, char **argv ) {
  7. char *settings_name;
  8. struct settings *settings;
  9. int rc;
  10. if ( argc > 2 ) {
  11. printf ( "Usage: %s [scope]\n"
  12. "Opens the option configuration console\n", argv[0] );
  13. return 1;
  14. }
  15. settings_name = ( ( argc == 2 ) ? argv[1] : "" );
  16. settings = find_settings ( settings_name );
  17. if ( ! settings ) {
  18. printf ( "No such scope \"%s\"\n", settings_name );
  19. return 1;
  20. }
  21. if ( ( rc = settings_ui ( settings ) ) != 0 ) {
  22. printf ( "Could not save settings: %s\n",
  23. strerror ( rc ) );
  24. return 1;
  25. }
  26. return 0;
  27. }
  28. struct command config_command __command = {
  29. .name = "config",
  30. .exec = config_exec,
  31. };