mirror of
https://github.com/xcat2/xNBA.git
synced 2026-01-12 01:52:30 +00:00
The && and || operators should be left-associative, since that is how
they are treated in most other languages (including C and Unix
shell). For example, in the command:
dhcp net0 && goto dhcp_ok || echo No DHCP on net0
if the "dhcp net0" fails then the "echo" should be executed.
After an "exit" or a successful "goto", further commands on the same
line should never be executed. For example:
goto somewhere && echo This should never be printed
exit 0 && echo This should never be printed
exit 1 && echo This should never be printed
An "exit" should cause the current shell or script to terminate and
return the specified exit status to its caller. For example:
chain test.ipxe && echo Success || echo Failure
[in test.ipxe]
#!ipxe
exit 0
should echo "Success".
Signed-off-by: Michael Brown <mcb30@ipxe.org>
27 lines
524 B
C
27 lines
524 B
C
#ifndef _IPXE_COMMAND_H
|
|
#define _IPXE_COMMAND_H
|
|
|
|
FILE_LICENCE ( GPL2_OR_LATER );
|
|
|
|
#include <ipxe/tables.h>
|
|
|
|
/** A command-line command */
|
|
struct command {
|
|
/** Name of the command */
|
|
const char *name;
|
|
/**
|
|
* Function implementing the command
|
|
*
|
|
* @v argc Argument count
|
|
* @v argv Argument list
|
|
* @ret rc Return status code
|
|
*/
|
|
int ( * exec ) ( int argc, char **argv );
|
|
};
|
|
|
|
#define COMMANDS __table ( struct command, "commands" )
|
|
|
|
#define __command __table_entry ( COMMANDS, 01 )
|
|
|
|
#endif /* _IPXE_COMMAND_H */
|