Allow command /Cdir
Fix quoting so that command /c mount d "/tmp/a b" works This breaks command /c "dir", but this doesn't work on real DOS either. Let's hope everything still works. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3728
This commit is contained in:
parent
8abf23aa8d
commit
6fc206193e
3 changed files with 35 additions and 1 deletions
|
@ -955,6 +955,39 @@ bool CommandLine::FindStringRemain(char const * const name,std::string & value)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* Only used for parsing command.com /C
|
||||
* Allowing /C dir and /Cdir
|
||||
* Restoring quotes back into the commands so command /C mount d "/tmp/a b" works as intended
|
||||
*/
|
||||
bool CommandLine::FindStringRemainBegin(char const * const name,std::string & value) {
|
||||
cmd_it it;value="";
|
||||
if (!FindEntry(name,it)) {
|
||||
size_t len = strlen(name);
|
||||
for (it=cmds.begin();it!=cmds.end();it++) {
|
||||
if (strncasecmp(name,(*it).c_str(),len)==0) {
|
||||
std::string temp = ((*it).c_str() + len);
|
||||
//Restore quotes for correct parsing in later stages
|
||||
if(temp.find(" ") != std::string::npos)
|
||||
value = std::string("\"") + temp + std::string("\"");
|
||||
else
|
||||
value = temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( it == cmds.end()) return false;
|
||||
}
|
||||
it++;
|
||||
for (;it!=cmds.end();it++) {
|
||||
value += " ";
|
||||
std::string temp = (*it);
|
||||
if(temp.find(" ") != std::string::npos)
|
||||
value += std::string("\"") + temp + std::string("\"");
|
||||
else
|
||||
value += temp;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CommandLine::GetStringRemain(std::string & value) {
|
||||
if(!cmds.size()) return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue