|
|
@@ -91,10 +91,16 @@ namespace snel { |
|
|
|
bool in{false}, out{false}, err{false}; |
|
|
|
|
|
|
|
for (auto& t: command) { |
|
|
|
if (t == "" || t== " ") |
|
|
|
continue; |
|
|
|
if (t == "" || t== " ") continue; // skip crap |
|
|
|
|
|
|
|
if (t == "&&") logic = LogicOp::AND; |
|
|
|
else if (t == "||") logic = LogicOp::OR; |
|
|
|
// one pass redirection parsing |
|
|
|
else if (!t.compare(0, 1, "<")) filenames[STDIN_] = t.substr(1); |
|
|
|
else if (!t.compare(0, 1, ">")) filenames[STDOUT_] = t.substr(1); |
|
|
|
else if (!t.compare(0, 2, "1>")) filenames[STDOUT_] = t.substr(2); |
|
|
|
else if (!t.compare(0, 2, "2>")) filenames[STDERR_] = t.substr(2); |
|
|
|
// two pass redirection parsing (if redirection came in 2 arguments) |
|
|
|
else if (t == "<") in = true; |
|
|
|
else if (t == "1>" || t == ">") out = true; |
|
|
|
else if (t == "2>") err = true; |
|
|
|