From 99c006629c108df79f6ceb8e588f12c9fe16f039 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 1 Sep 2015 09:26:14 -1000 Subject: [PATCH] Y/n POSIX prompt --- hecl/driver/ToolExtract.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hecl/driver/ToolExtract.hpp b/hecl/driver/ToolExtract.hpp index a37086c56..4235ed65d 100644 --- a/hecl/driver/ToolExtract.hpp +++ b/hecl/driver/ToolExtract.hpp @@ -3,7 +3,12 @@ #include "ToolBase.hpp" #include + +#if _WIN32 #include +#else +#include +#endif class ToolExtract final : public ToolBase { @@ -166,13 +171,26 @@ public: #endif int ch; +#ifndef _WIN32 + struct termios tioOld, tioNew; + tcgetattr(0, &tioOld); + tioNew = tioOld; + tioNew.c_lflag &= ~ICANON; + tcsetattr(0, TCSANOW, &tioNew); + while ((ch = getchar())) +#else while ((ch = getch())) +#endif { if (ch == 'n' || ch == 'N') return 0; if (ch == 'y' || ch == 'Y' || ch == 13) break; } +#ifndef _WIN32 + tcsetattr(0, TCSANOW, &tioOld); +#endif + HECL::Printf(_S("\n")); for (SpecExtractPass& ds : m_specPasses)