iPXE
command.h
Go to the documentation of this file.
1 #ifndef _IPXE_COMMAND_H
2 #define _IPXE_COMMAND_H
3 
4 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
5 FILE_SECBOOT ( PERMITTED );
6 
7 #include <ipxe/tables.h>
8 
9 /** A command-line command */
10 struct command {
11  /** Name of the command */
12  const char *name;
13  /**
14  * Function implementing the command
15  *
16  * @v argc Argument count
17  * @v argv Argument list
18  * @ret rc Return status code
19  */
20  int ( * exec ) ( int argc, char **argv );
21 };
22 
23 #define COMMANDS __table ( struct command, "commands" )
24 
25 #define __command( name ) __table_entry ( COMMANDS, _C2 ( 01., name ) )
26 
27 #define COMMAND( name, exec ) \
28  struct command name ## _command __command ( name ) = { \
29  #name, exec \
30  }
31 
32 extern char * concat_args ( char **args );
33 
34 #endif /* _IPXE_COMMAND_H */
int(* exec)(int argc, char **argv)
Function implementing the command.
Definition: command.h:20
A command-line command.
Definition: command.h:10
char * concat_args(char **args)
Concatenate arguments.
Definition: exec.c:359
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
const char * name
Name of the command.
Definition: command.h:12
FILE_SECBOOT(PERMITTED)
Linker tables.