diff --git a/RunCPM/abstraction_posix.h b/RunCPM/abstraction_posix.h index 7b5334b..f350950 100644 --- a/RunCPM/abstraction_posix.h +++ b/RunCPM/abstraction_posix.h @@ -483,6 +483,7 @@ uint32 _HardwareIn(const uint32 Port) { static struct argp_option options[] = { {"input", 'i', "FILE", 0, "File to read console input from"}, {"output", 'o', "FILE", 0, "File to log console output to"}, + {"stdio", 's', NULL, 0, "Route console in/out to stdin/out"}, {0} }; @@ -504,6 +505,10 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) "error opening console log output file %s", arg); } break; + case 's': + console_in = stdin; + console_log = stdout; + break; case ARGP_KEY_ARG: case ARGP_KEY_END: break; diff --git a/RunCPM/console.h b/RunCPM/console.h index 43a00c6..f55fecf 100644 --- a/RunCPM/console.h +++ b/RunCPM/console.h @@ -12,9 +12,11 @@ uint8 mask8bit = 0x7f; // TO be used for masking 8 bit characters (XMODEM relat void _putcon(uint8 ch) // Puts a character { - _putch(ch & mask8bit); #ifdef SCRIPTCONSOLE + if (console_log != stdout) _putch(ch & mask8bit); if (console_log) fputc(ch & mask8bit, console_log); +#else + _putch(ch & mask8bit); #endif }