From 7bebe9579ee5ea1cfcfcdf25032dbab80ccc489f Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 29 Nov 2010 14:19:59 +0000 Subject: [cmdline] Match user expectations for &&, ||, goto, and exit 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 --- src/hci/shell.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/hci') diff --git a/src/hci/shell.c b/src/hci/shell.c index 7bf138a2..3860b2e4 100644 --- a/src/hci/shell.c +++ b/src/hci/shell.c @@ -84,8 +84,7 @@ int shell ( void ) { rc = system ( line ); free ( line ); } - } while ( shell_exit == 0 ); - shell_exit = 0; + } while ( ! shell_stopped ( SHELL_STOP_COMMAND_SEQUENCE ) ); return rc; } -- cgit v1.2.3-55-g7522