瀏覽代碼

Minor change for std redirection argument parsing

master
Christos Houtouridis 5 年之前
父節點
當前提交
e284226897
共有 1 個檔案被更改,包括 8 行新增2 行删除
  1. +8
    -2
      src/sequencer.cpp

+ 8
- 2
src/sequencer.cpp 查看文件

@@ -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…
取消
儲存