Bläddra i källkod

Minor change for std redirection argument parsing

master
Christos Houtouridis 5 år sedan
förälder
incheckning
e284226897
1 ändrade filer med 8 tillägg och 2 borttagningar
  1. +8
    -2
      src/sequencer.cpp

+ 8
- 2
src/sequencer.cpp Visa fil

@@ -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;


Laddar…
Avbryt
Spara