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.

123456789101112131415161718192021222324252627282930313233343536373839
  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. FILE_LICENCE ( GPL2_OR_LATER );
  7. static int config_exec ( int argc, char **argv ) {
  8. char *settings_name;
  9. struct settings *settings;
  10. int rc;
  11. if ( argc > 2 ) {
  12. printf ( "Usage: %s [scope]\n"
  13. "Opens the option configuration console\n", argv[0] );
  14. return 1;
  15. }
  16. settings_name = ( ( argc == 2 ) ? argv[1] : "" );
  17. settings = find_settings ( settings_name );
  18. if ( ! settings ) {
  19. printf ( "No such scope \"%s\"\n", settings_name );
  20. return 1;
  21. }
  22. if ( ( rc = settings_ui ( settings ) ) != 0 ) {
  23. printf ( "Could not save settings: %s\n",
  24. strerror ( rc ) );
  25. return 1;
  26. }
  27. return 0;
  28. }
  29. struct command config_command __command = {
  30. .name = "config",
  31. .exec = config_exec,
  32. };