Exit properly on halt and quit
diff --git a/src/bc/vm.c b/src/bc/vm.c
index 12e7ae0..a665c0a 100644
--- a/src/bc/vm.c
+++ b/src/bc/vm.c
@@ -153,7 +153,7 @@
fflush(stdout);
- if (status) bc_error(status);
+ if (status) goto read_err;
if (bcg.bc_signal) {
@@ -370,7 +370,7 @@
fflush(stdout);
- if (status) bc_error(status);
+ if (status) goto exit_err;
if (bcg.bc_signal) {
if ((status = bc_vm_signal(vm))) bc_error(status);
@@ -453,12 +453,9 @@
for (i = 0; !status && i < num_files; ++i) status = bc_vm_execFile(vm, i);
- if (status != BC_STATUS_SUCCESS &&
- status != BC_STATUS_PARSE_QUIT &&
- status != BC_STATUS_EXEC_HALT)
- {
- return status;
- }
+ if (status)
+ return status == BC_STATUS_PARSE_QUIT || status == BC_STATUS_EXEC_HALT ?
+ BC_STATUS_SUCCESS : status;
status = bc_vm_execStdin(vm);