iPXE
Data Structures | Functions | Variables
poweroff_cmd.c File Reference

Power off command. More...

#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/reboot.h>

Go to the source code of this file.

Data Structures

struct  poweroff_options
 "poweroff" options More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static int poweroff_exec (int argc, char **argv)
 The "poweroff" command.

Variables

static struct option_descriptor poweroff_opts [] = {}
 "poweroff" option list
static struct command_descriptor poweroff_cmd
 "poweroff" command descriptor
struct command poweroff_command __command
 "poweroff" command

Detailed Description

Power off command.

Definition in file poweroff_cmd.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static int poweroff_exec ( int  argc,
char **  argv 
) [static]

The "poweroff" command.

Parameters:
argcArgument count
argvArgument list
Return values:
rcReturn status code

Definition at line 56 of file poweroff_cmd.c.

References parse_options(), poweroff(), printf(), rc, and strerror().

                                                   {
        struct poweroff_options opts;
        int rc;

        /* Parse options */
        if ( ( rc = parse_options ( argc, argv, &poweroff_cmd, &opts ) ) != 0 )
                return rc;

        /* Power off system */
        rc = poweroff();
        if ( rc != 0 )
                printf ( "Could not power off: %s\n", strerror ( rc ) );

        return rc;
}

Variable Documentation

struct option_descriptor poweroff_opts[] = {} [static]

"poweroff" option list

Definition at line 43 of file poweroff_cmd.c.

Initial value:

"poweroff" command descriptor

Definition at line 46 of file poweroff_cmd.c.

struct command poweroff_command __command
Initial value:
 {
        .name = "poweroff",
        .exec = poweroff_exec,
}

"poweroff" command

Definition at line 73 of file poweroff_cmd.c.