@@ -96,6 +96,8 @@ void create_parser(QCommandLineParser &p) {
9696 p.addOption (
9797 { { " serial-out" , " serout" }, " File connected to the serial port output." , " FNAME" });
9898 p.addOption ({ { " os-emulation" , " osemu" }, " Operating system emulation." });
99+ p.addOption (
100+ { { " std-in" , " stdin" }, " File connected to the syscall standard input." , " FNAME" });
99101 p.addOption (
100102 { { " std-out" , " stdout" }, " File connected to the syscall standard output." , " FNAME" });
101103 p.addOption (
@@ -419,8 +421,13 @@ void configure_serial_port(QCommandLineParser &p, SerialPort *ser_port) {
419421
420422void configure_osemu (QCommandLineParser &p, MachineConfig &config, Machine *machine) {
421423 CharIOHandler *std_out = nullptr ;
424+ QScopedPointer<QString> std_in_path;
422425 int siz;
423426
427+ siz = p.values (" std-in" ).size ();
428+ if (siz >= 1 ) {
429+ std_in_path.reset (new QString (p.values (" std-in" ).at (siz - 1 )));
430+ }
424431 siz = p.values (" std-out" ).size ();
425432 if (siz >= 1 ) {
426433 auto *qf = new QFile (p.values (" std-out" ).at (siz - 1 ));
@@ -438,6 +445,12 @@ void configure_osemu(QCommandLineParser &p, MachineConfig &config, Machine *mach
438445 auto *osemu_handler = new osemu::OsSyscallExceptionHandler (
439446 config.osemu_known_syscall_stop (), config.osemu_unknown_syscall_stop (),
440447 config.osemu_fs_root ());
448+ if (!std_in_path.isNull () && !std_in_path->isEmpty ()) {
449+ if (!osemu_handler->map_stdin_to_hostfile (*std_in_path)) {
450+ fprintf (stderr, " Failed to map stdin to host file '%s'\n " , std_in_path->toLatin1 ().data ());
451+ exit (EXIT_FAILURE);
452+ }
453+ }
441454 if (std_out) {
442455 machine::Machine::connect (
443456 osemu_handler, &osemu::OsSyscallExceptionHandler::char_written, std_out,
0 commit comments