Browse Source

Minor change for std redirection argument parsing

master
Christos Houtouridis 5 years ago
parent
commit
e284226897
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      src/sequencer.cpp

+ 8
- 2
src/sequencer.cpp View File

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


Loading…
Cancel
Save