26#ifndef MYSQLHARNESS_TTY_INCLUDED
27#define MYSQLHARNESS_TTY_INCLUDED
29#include "harness_export.h"
42class HARNESS_EXPORT
Tty {
50 static fd_type fd_from_stream(std::ostream &os);
51 static fd_type fd_from_stream(std::istream &is);
57 }
catch (
const std::system_error &) {
72 }
catch (
const std::system_error &) {
84 static constexpr const size_t kEcho = ENABLE_ECHO_INPUT;
85 static constexpr const size_t kExtendedFlags = ENABLE_EXTENDED_FLAGS;
86 static constexpr const size_t kInsertMode = ENABLE_INSERT_MODE;
87 static constexpr const size_t kLineInput = ENABLE_LINE_INPUT;
88 static constexpr const size_t kMouseInput = ENABLE_MOUSE_INPUT;
89 static constexpr const size_t kProcessedInput = ENABLE_PROCESSED_INPUT;
90 static constexpr const size_t kQuickEditMode = ENABLE_QUICK_EDIT_MODE;
91 static constexpr const size_t kWindowInput = ENABLE_WINDOW_INPUT;
92#if VER_PRODUCTBUILD >= 10011
94 static constexpr const size_t kVirtualTerminalInput =
95 ENABLE_VIRTUAL_TERMINAL_INPUT;
100 static constexpr const size_t kProcessedOutput =
101 ENABLE_PROCESSED_OUTPUT;
102 static constexpr const size_t kWrapAtEolOutput =
103 ENABLE_WRAP_AT_EOL_OUTPUT;
104#if VER_PRODUCTBUILD >= 10011
106 static constexpr const size_t kVirtualTerminalProcessing =
107 ENABLE_VIRTUAL_TERMINAL_PROCESSING;
108 static constexpr const size_t kDisableNewlineAutoReturn =
109 DISABLE_NEWLINE_AUTO_RETURN;
110 static constexpr const size_t kLvbGridWorldwide =
111 ENABLE_LVB_GRID_WORLDWIDE;
120 static constexpr const size_t kGenerateSignal = ISIG;
121 static constexpr const size_t kCanonicalMode = ICANON;
124 static constexpr const size_t kConvertCase = XCASE;
126 static constexpr const size_t kEcho =
ECHO;
127 static constexpr const size_t kEchoWithErase = ECHOE;
128 static constexpr const size_t kEchoWithKill = ECHOK;
129 static constexpr const size_t kEchoWithNewline = ECHONL;
130 static constexpr const size_t kEchoWithControl = ECHOCTL;
131 static constexpr const size_t kEchoWithPrint = ECHOPRT;
132 static constexpr const size_t kEchoWithKillEares = ECHOKE;
134 static constexpr const size_t kOutputFlushed = FLUSHO;
135 static constexpr const size_t kNoFlush = NOFLSH;
136 static constexpr const size_t kToStop = TOSTOP;
137 static constexpr const size_t kPending = PENDIN;
138 static constexpr const size_t kExtendedInputProcessing = IEXTEN;
144 static constexpr const size_t kBaudSpeedMask = CBAUD;
148 static constexpr const size_t kBaudSpeedMaskExtra = CBAUDEX;
152 static constexpr const size_t kInputBaudSpeedMaskExtra = CIBAUDEX;
154 static constexpr const size_t kCharacterSizeMask = CSIZE;
155 static constexpr const size_t kTwoStopBits = CSTOPB;
156 static constexpr const size_t kEnableReceiver = CREAD;
157 static constexpr const size_t kParityCheckGenerator = PARENB;
158 static constexpr const size_t kParityOdd = PARODD;
159 static constexpr const size_t kHangupOnClose = HUPCL;
160 static constexpr const size_t kIgnoreControlLines = CLOCAL;
162 static constexpr const size_t kBlockOutputNonCurrentShellLayer = LOBLK;
166 static constexpr const size_t kInputSpeedMask = CIBAUD;
170 static constexpr const size_t kStickParity = CMSPAR;
174 static constexpr const size_t kEnableSoftFlowControl = CRTSXOFF;
176 static constexpr const size_t kEnableHardFlowControl = CRTSCTS;
180 static constexpr const size_t kOutputProcessing = OPOST;
181 static constexpr const size_t kMapNewlineCarriageReturn = ONLCR;
184 static constexpr const size_t kMapLowercaseUppercase = OLCUC;
186 static constexpr const size_t kMapCarriageReturnNewline = OCRNL;
187 static constexpr const size_t kNoOutputCarriageReturnOnColumnZero =
189 static constexpr const size_t kNoOutputCarriageReturn = ONLRET;
192 static constexpr const size_t kSendFillCharacter = OFILL;
196 static constexpr const size_t kFillCharacterIsDelete = OFDEL;
200 static constexpr const size_t kNewlineDelayMask = NLDLY;
204 static constexpr const size_t kCarriangeReturnDelayMask = CRDLY;
206 static constexpr const size_t kHorizontalTabDelayMask = TABDLY;
209 static constexpr const size_t kBackspaceDelayMask = BSDLY;
213 static constexpr const size_t kVerticalTabDelayMask = VTDLY;
217 static constexpr const size_t kFormfeedDelayMask = FFDLY;
222 static constexpr const size_t kIgnoreBreak = IGNBRK;
223 static constexpr const size_t kBreakInt = BRKINT;
224 static constexpr const size_t kIgnoreParityError = IGNPAR;
225 static constexpr const size_t kParityErrorMark = PARMRK;
226 static constexpr const size_t kInputParityChecking = INPCK;
227 static constexpr const size_t kStripCharacter = ISTRIP;
228 static constexpr const size_t kMapNewlineCarriageReturn = INLCR;
229 static constexpr const size_t kIgnoreCarriageReturn = IGNCR;
230 static constexpr const size_t kMapCarriageReturnNewline = ICRNL;
233 static constexpr const size_t kMapUppercaseLowercase = IUCLC;
235 static constexpr const size_t kStartStopOutputControl = IXON;
236 static constexpr const size_t kAnyCharacterRestartOutput = IXANY;
237 static constexpr const size_t kStartStopInputControl = IXOFF;
238 static constexpr const size_t kEchoBellOnInputLong = IMAXBEL;
241 static constexpr const size_t kInputIsUtf8 = IUTF8;
265 bool is_saved_{
false};
Tty(fd_type fd)
Definition: tty.h:53
Tty & operator=(const Tty &)=delete
fd_type fd_
Definition: tty.h:263
state_type state_
Definition: tty.h:264
int fd_type
Definition: tty.h:44
void restore_attrs()
Definition: tty.h:254
termios state_type
Definition: tty.h:48
~Tty()
restore the state of the Tty if we changed it.
Definition: tty.h:68
#define ECHO
Definition: lexyy.cc:1051
#define window_size
Definition: log_event.cc:175