2 * Copyright (C) 2013 Marin Hannache <ipxe@mareo.fr>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 #include <ipxe/command.h>
24 #include <ipxe/parseopt.h>
25 #include <ipxe/reboot.h>
27 FILE_LICENCE ( GPL2_OR_LATER );
35 /** "poweroff" options */
36 struct poweroff_options {};
38 /** "poweroff" option list */
39 static struct option_descriptor poweroff_opts[] = {};
41 /** "poweroff" command descriptor */
42 static struct command_descriptor poweroff_cmd =
43 COMMAND_DESC ( struct poweroff_options, poweroff_opts, 0, 0, NULL );
46 * The "poweroff" command
48 * @v argc Argument count
49 * @v argv Argument list
50 * @ret rc Return status code
52 static int poweroff_exec ( int argc, char **argv ) {
53 struct poweroff_options opts;
57 if ( ( rc = parse_options ( argc, argv, &poweroff_cmd, &opts ) ) != 0 )
60 /* Power off system */
63 printf ( "Could not power off: %s\n", strerror ( rc ) );
68 /** "poweroff" command */
69 struct command poweroff_command __command = {
71 .exec = poweroff_exec,