diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-05-23 16:26:52 -0500 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-05-23 16:46:49 -0500 |
commit | 44cf36b76f2d159158a0f6a0d03fa34fff45a2c5 (patch) | |
tree | 6ceb5c532ac5389142153f9393a2de44be49b293 | |
parent | main_semobtain.c: Locked access to executing (diff) | |
download | rtems-schedsim-44cf36b76f2d159158a0f6a0d03fa34fff45a2c5.tar.bz2 |
schedsim.cc: Exit on bad command result
-rw-r--r-- | schedsim/shell/schedsim_smpsimple/schedsim.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/schedsim/shell/schedsim_smpsimple/schedsim.cc b/schedsim/shell/schedsim_smpsimple/schedsim.cc index f0960a8..5136ac9 100644 --- a/schedsim/shell/schedsim_smpsimple/schedsim.cc +++ b/schedsim/shell/schedsim_smpsimple/schedsim.cc @@ -48,6 +48,7 @@ void ProcessScript( ) { char buffer[512]; + int sc; char *cStatus; char *c; size_t length; @@ -79,7 +80,7 @@ void ProcessScript( if (!strcmp(c,"bye") || !strcmp(c,"exit")) { - return; + exit( 0 ); } if (rtems_shell_make_args(c, &argc, argv, RTEMS_SHELL_MAXIMUM_ARGUMENTS)) { @@ -93,10 +94,14 @@ void ProcessScript( shell_cmd = rtems_shell_lookup_cmd(argv[0]); if ( !shell_cmd ) { fprintf(stderr, "%s is unknown command\n", c ); - continue; + exit( 1 ); } - shell_cmd->command(argc, argv); + sc = shell_cmd->command(argc, argv); + if ( sc != 0 ) { + fprintf( stderr, "ERROR: Command %s returned %d\n", argv[0], sc ); + exit( sc ); + } } } |