mirror of
https://github.com/xcat2/xNBA.git
synced 2026-03-25 15:53:29 +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>
37 lines
721 B
C
37 lines
721 B
C
#ifndef _IPXE_SHELL_H
|
|
#define _IPXE_SHELL_H
|
|
|
|
/** @file
|
|
*
|
|
* Minimal command shell
|
|
*
|
|
*/
|
|
|
|
FILE_LICENCE ( GPL2_OR_LATER );
|
|
|
|
/** Shell stop states */
|
|
enum shell_stop_state {
|
|
/** Continue processing */
|
|
SHELL_CONTINUE = 0,
|
|
/**
|
|
* Stop processing current command line
|
|
*
|
|
* This is the stop state entered by commands that change the flow
|
|
* of execution, such as "goto".
|
|
*/
|
|
SHELL_STOP_COMMAND = 1,
|
|
/**
|
|
* Stop processing commands
|
|
*
|
|
* This is the stop state entered by commands that terminate
|
|
* the flow of execution, such as "exit".
|
|
*/
|
|
SHELL_STOP_COMMAND_SEQUENCE = 2,
|
|
};
|
|
|
|
extern void shell_stop ( int stop );
|
|
extern int shell_stopped ( int stop );
|
|
extern int shell ( void );
|
|
|
|
#endif /* _IPXE_SHELL_H */
|