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 797B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #include <gpxe/nvo.h>
  7. extern struct nvo_block *ugly_nvo_hack;
  8. static int config_exec ( int argc, char **argv ) {
  9. struct config_context dummy_context;
  10. int rc;
  11. if ( argc != 1 ) {
  12. printf ( "Usage: %s\n"
  13. "Opens the option configuration console\n", argv[0] );
  14. return 1;
  15. }
  16. if ( ! ugly_nvo_hack ) {
  17. printf ( "No non-volatile option storage available\n" );
  18. return 1;
  19. }
  20. dummy_context.options = ugly_nvo_hack->options;
  21. if ( ( rc = settings_ui ( &dummy_context ) ) != 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. };