1
0
Fork 0
mirror of https://gitlab.com/niansa/pilang2.git synced 2025-03-06 20:49:22 +01:00

Fixed bug with # in string

This commit is contained in:
niansa 2020-05-02 12:36:38 +01:00
parent 56393f28f0
commit 8a4572991c

View file

@ -478,7 +478,9 @@ void init_interpreter(int argc, char *argv[]) {
}
std::string execline(std::string commandstr) {
commandstr = ltrim(commandstr.substr(0, commandstr.find("#", 0)));
commandstr = ltrim(commandstr);
if (commandstr[0] == '#')
return success;
//std::cout << "$ " << commandstr << std::endl;
if (rtrim(commandstr) == "") { // Command is empty
return commandstr;
@ -508,13 +510,14 @@ std::string execline(std::string commandstr) {
bool charig = false;
bool skipall = false;
for (std::string::iterator currchar = argsstr.begin(); currchar < argsstr.end(); currchar++) {
if (skipall) {
if (skipall and *currchar != ',') {
continue;
} else if (*currchar == '"' and !skipall) {
instring = !instring;
if (currarg == "")
arginstring = true;
} else if (*currchar == '#' and !charig and !instring) {
*(currchar + 1) = ',';
skipall = true;
} else if (*currchar == ',' and !charig and !instring) {
if (currarg.length() != 0 and *currarg.begin() == '$' and !arginstring) {