Parcourir la source

Minor change for std redirection argument parsing

master
Christos Houtouridis il y a 5 ans
Parent
révision
e284226897
1 fichiers modifiés avec 8 ajouts et 2 suppressions
  1. +8
    -2
      src/sequencer.cpp

+ 8
- 2
src/sequencer.cpp Voir le fichier

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


Chargement…
Annuler
Enregistrer