From 090c80cb90fa2ad50b4128d40acdb57b488e0d7e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 7 Sep 2014 13:40:00 -0400 Subject: [PATCH] Parser - Removed ::appendStdin. --- src/Parser.cpp | 46 ---------------------------------------------- src/Parser.h | 1 - src/main.h | 1 - 3 files changed, 48 deletions(-) diff --git a/src/Parser.cpp b/src/Parser.cpp index acb027f86..12174284c 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -38,10 +38,6 @@ #include #include -#ifdef FEATURE_STDIN -#include -#endif - extern Context context; // Overridden by rc.abbreviation.minimum. @@ -166,48 +162,6 @@ void Parser::clear () _tree = new Tree ("root"); } -//////////////////////////////////////////////////////////////////////////////// -// Add an arg for every word from std::cin. -// -// echo one two -- three | task zero --> task zero one two -// 'three' is left in the input buffer. -void Parser::appendStdin () -{ -#ifdef FEATURE_STDIN - // Use 'select' to determine whether there is any std::cin content buffered - // before trying to read it, to prevent blocking. - struct timeval tv; - tv.tv_sec = 0; - tv.tv_usec = 1000; - - fd_set fds; - FD_ZERO (&fds); - FD_SET (STDIN_FILENO, &fds); - - int result = select (STDIN_FILENO + 1, &fds, NULL, NULL, &tv); - if (result && result != -1) - { - if (FD_ISSET (0, &fds)) - { - int i = 0; - std::string arg; - while (std::cin >> arg) - { - // It the terminator token is found, stop reading. - if (arg == "--") - break; - - Tree* branch = _tree->addBranch (new Tree (format ("stdin{1}", i++))); - branch->attribute ("raw", arg); - branch->tag ("ORIGINAL"); - branch->tag ("STDIN"); - branch->tag ("?"); - } - } - } -#endif -} - //////////////////////////////////////////////////////////////////////////////// Tree* Parser::tree () { diff --git a/src/Parser.h b/src/Parser.h index 5180987ee..a7075dd07 100644 --- a/src/Parser.h +++ b/src/Parser.h @@ -42,7 +42,6 @@ public: void initialize (int, const char**); void clear (); - void appendStdin (); Tree* tree (); Tree* parse (); void alias (const std::string&, const std::string&); diff --git a/src/main.h b/src/main.h index 0e7925e3d..5ae2d8d24 100644 --- a/src/main.h +++ b/src/main.h @@ -28,7 +28,6 @@ #define INCLUDED_MAIN #define FEATURE_COLOR 1 // Enable color. -//#define FEATURE_STDIN 1 // Enable reading stdin. #include #include