Y/n POSIX prompt

This commit is contained in:
Jack Andersen 2015-09-01 09:26:14 -10:00
parent c9a295b092
commit 99c006629c
1 changed files with 18 additions and 0 deletions

View File

@ -3,7 +3,12 @@
#include "ToolBase.hpp"
#include <stdio.h>
#if _WIN32
#include <conio.h>
#else
#include <termios.h>
#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)