From 24e82f2d331b823abd7c1eadb5ae1e72e4401855 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 8 Apr 2003 18:24:38 +0000 Subject: [PATCH] command /c works with batch files as well :) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@889 --- src/shell/shell.cpp | 24 +++++++++++++++++++++++- src/shell/shell_inc.h | 3 ++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index 455f528d..b5e000d3 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -93,13 +93,35 @@ void DOS_Shell::ParseLine(char * line) { +void DOS_Shell::RunInternal(void) +{ + char input_line[CMD_MAXLINE]; + std::string line; + while(bf && bf->ReadLine(input_line)) + { + if (echo) { + if (input_line[0]!='@') { + ShowPrompt(); + WriteOut(input_line); + WriteOut("\n"); + }; + }; + ParseLine(input_line); + } + return; +} + + void DOS_Shell::Run(void) { char input_line[CMD_MAXLINE]; std::string line; if (cmd->FindStringRemain("/C",line)) { strcpy(input_line,line.c_str()); - ParseLine(input_line); + DOS_Shell temp; + temp.echo = echo; + temp.ParseLine(input_line); //for *.exe *.com |*.bat creates the bf needed by runinternal; + temp.RunInternal(); // exits when no bf is found. return; } /* Start a normal shell and check for a first command init */ diff --git a/src/shell/shell_inc.h b/src/shell/shell_inc.h index 21947803..a3057e31 100644 --- a/src/shell/shell_inc.h +++ b/src/shell/shell_inc.h @@ -52,6 +52,7 @@ class DOS_Shell : public Program { public: DOS_Shell(); void Run(void); + void RunInternal(void); //for command /C /* A load of subfunctions */ void ParseLine(char * line); Bit32u GetRedirection(char *s, char **ifn, char **ofn); @@ -90,7 +91,7 @@ public: Bitu index; Bitu size; } old; - + }; struct SHELL_Cmd {