mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
Adjust the simple parser in ForkedCalls.cpp to also account for quotes
don't delimiting an entire word and adapt the quoting such that it works for Systemcall, ForkedCall, and also for the case when QProcess in not used. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39759 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e5cc5ac2e8
commit
b53445e6cd
@ -323,20 +323,26 @@ int ForkedCall::generateChild()
|
|||||||
// 2. If we are inside quotes, then don't replace the white space
|
// 2. If we are inside quotes, then don't replace the white space
|
||||||
// but do remove the quotes themselves. We do this naively by
|
// but do remove the quotes themselves. We do this naively by
|
||||||
// replacing the quote with '\0' which is fine if quotes
|
// replacing the quote with '\0' which is fine if quotes
|
||||||
// delimit the entire word.
|
// delimit the entire word. However, if quotes do not delimit the
|
||||||
|
// entire word (i.e., open quote is inside word), leave them alone.
|
||||||
char inside_quote = 0;
|
char inside_quote = 0;
|
||||||
|
char c_before_open_quote = ' ';
|
||||||
vector<char>::iterator it = vec.begin();
|
vector<char>::iterator it = vec.begin();
|
||||||
vector<char>::iterator const end = vec.end();
|
vector<char>::iterator const end = vec.end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
char const c = *it;
|
char const c = *it;
|
||||||
if (!inside_quote) {
|
if (!inside_quote) {
|
||||||
if (c == ' ')
|
if (c == '\'' || c == '"') {
|
||||||
*it = '\0';
|
if (c_before_open_quote == ' ')
|
||||||
else if (c == '\'' || c == '"') {
|
|
||||||
*it = '\0';
|
*it = '\0';
|
||||||
inside_quote = c;
|
inside_quote = c;
|
||||||
|
} else {
|
||||||
|
if (c == ' ')
|
||||||
|
*it = '\0';
|
||||||
|
c_before_open_quote = c;
|
||||||
}
|
}
|
||||||
} else if (c == inside_quote) {
|
} else if (c == inside_quote) {
|
||||||
|
if (c_before_open_quote = ' ')
|
||||||
*it = '\0';
|
*it = '\0';
|
||||||
inside_quote = 0;
|
inside_quote = 0;
|
||||||
}
|
}
|
||||||
|
@ -590,7 +590,7 @@ string latexEnvCmdPrefix(string const & path)
|
|||||||
string const texinputs = getEnv("TEXINPUTS");
|
string const texinputs = getEnv("TEXINPUTS");
|
||||||
|
|
||||||
if (os::shell() == os::UNIX)
|
if (os::shell() == os::UNIX)
|
||||||
return "env 'TEXINPUTS=." + sep + texinputs_prefix
|
return "env TEXINPUTS='." + sep + texinputs_prefix
|
||||||
+ sep + texinputs + "' ";
|
+ sep + texinputs + "' ";
|
||||||
else
|
else
|
||||||
return "cmd /d /c set TEXINPUTS=." + sep + texinputs_prefix
|
return "cmd /d /c set TEXINPUTS=." + sep + texinputs_prefix
|
||||||
|
Loading…
Reference in New Issue
Block a user