FreeCalypso > hg > fc-sim-tools
diff libcommon/exit.c @ 54:812779459ddd
Calypso exit mode: show any output from back end
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 Mar 2021 20:58:20 +0000 |
parents | c9ef9e91dd8e |
children |
line wrap: on
line diff
--- a/libcommon/exit.c Sun Mar 21 20:46:09 2021 +0000 +++ b/libcommon/exit.c Sun Mar 21 20:58:20 2021 +0000 @@ -4,14 +4,23 @@ #include <strings.h> extern unsigned calypso_fd; -extern FILE *cpipeF; +extern FILE *cpipeF, *rpipeF; + +calypso_poweroff() +{ + int c; + + fputs("poweroff\n", cpipeF); + fflush(cpipeF); + while ((c = getc(rpipeF)) != EOF) + putchar(c); + exit(0); +} good_exit() { - if (calypso_fd) { - fputs("poweroff\n", cpipeF); - fflush(cpipeF); - } + if (calypso_fd) + calypso_poweroff(); exit(0); } @@ -27,11 +36,8 @@ } if (!strcmp(argv[1], "bare")) exit(0); - if (!strcmp(argv[1], "iota-off")) { - fputs("poweroff\n", cpipeF); - fflush(cpipeF); - exit(0); - } + if (!strcmp(argv[1], "iota-off")) + calypso_poweroff(); fprintf(stderr, "error: \"%s\" is not an understood exit mode\n", argv[1]); return(-1);