david/ipxe
Archived
1
0
This repository has been archived on 2020-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
ipxe/src/hci/commands/sanboot_cmd.c
Michael Brown 8406115834 [build] Rename gPXE to iPXE
Access to the gpxe.org and etherboot.org domains and associated
resources has been revoked by the registrant of the domain.  Work
around this problem by renaming project from gPXE to iPXE, and
updating URLs to match.

Also update README, LOG and COPYRIGHTS to remove obsolete information.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-19 23:43:39 +01:00

71 lines
1.3 KiB
C

#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <ipxe/command.h>
#include <usr/autoboot.h>
FILE_LICENCE ( GPL2_OR_LATER );
/**
* "sanboot" command syntax message
*
* @v argv Argument list
*/
static void sanboot_syntax ( char **argv ) {
printf ( "Usage:\n"
" %s <root-path>\n"
"\n"
"Boot from SAN target\n",
argv[0] );
}
/**
* The "sanboot" command
*
* @v argc Argument count
* @v argv Argument list
* @ret rc Exit code
*/
static int sanboot_exec ( int argc, char **argv ) {
static struct option longopts[] = {
{ "help", 0, NULL, 'h' },
{ NULL, 0, NULL, 0 },
};
const char *root_path = NULL;
int c;
int rc;
/* Parse options */
while ( ( c = getopt_long ( argc, argv, "h", longopts, NULL ) ) >= 0 ){
switch ( c ) {
case 'h':
/* Display help text */
default:
/* Unrecognised/invalid option */
sanboot_syntax ( argv );
return 1;
}
}
/* Need exactly one image name remaining after the options */
if ( optind != ( argc - 1 ) ) {
sanboot_syntax ( argv );
return 1;
}
root_path = argv[optind];
/* Boot from root path */
if ( ( rc = boot_root_path ( root_path ) ) != 0 ) {
printf ( "Could not boot from %s: %s\n",
root_path, strerror ( rc ) );
return 1;
}
return 0;
}
struct command sanboot_command __command = {
.name = "sanboot",
.exec = sanboot_exec,
};