PATH:
opt
/
bitninja-threat-hunting
/
node_modules
/
node-pty
/
deps
/
winpty
/
misc
/* * Unix test code that puts the terminal into raw mode, then echos typed * characters to stdout. Derived from sample code in the Stevens book, posted * online at http://www.lafn.org/~dave/linux/terminalIO.html. */ #include <termios.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include "FormatChar.h" static struct termios save_termios; static int term_saved; /* RAW! mode */ int tty_raw(int fd) { struct termios buf; if (tcgetattr(fd, &save_termios) < 0) /* get the original state */ return -1; buf = save_termios; /* echo off, canonical mode off, extended input processing off, signal chars off */ buf.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG); /* no SIGINT on BREAK, CR-to-NL off, input parity check off, don't strip the 8th bit on input, ouput flow control off */ buf.c_iflag &= ~(BRKINT | ICRNL | ISTRIP | IXON); /* clear size bits, parity checking off */ buf.c_cflag &= ~(CSIZE | PARENB); /* set 8 bits/char */ buf.c_cflag |= CS8; /* output processing off */ buf.c_oflag &= ~(OPOST); buf.c_cc[VMIN] = 1; /* 1 byte at a time */ buf.c_cc[VTIME] = 0; /* no timer on input */ if (tcsetattr(fd, TCSAFLUSH, &buf) < 0) return -1; term_saved = 1; return 0; } /* set it to normal! */ int tty_reset(int fd) { if (term_saved) if (tcsetattr(fd, TCSAFLUSH, &save_termios) < 0) return -1; return 0; } int main() { tty_raw(0); int count = 0; while (true) { char ch; char buf[16]; int actual = read(0, &ch, 1); if (actual != 1) { perror("read error"); break; } formatChar(buf, ch); fputs(buf, stdout); fflush(stdout); if (ch == 3) // Ctrl-C break; } tty_reset(0); return 0; }
[-] DebugServer.py
[edit]
[+]
Font-Report-June2016
[-] Win32Echo1.cc
[edit]
[-] font-notes.txt
[edit]
[-] ShowArgv.cc
[edit]
[-] SetCursorPos.cc
[edit]
[-] UnicodeDoubleWidthTest.cc
[edit]
[-] SetBufferSize.cc
[edit]
[-] GetFont.cc
[edit]
[-] FreezePerfTest.cc
[edit]
[-] color-test.sh
[edit]
[+]
..
[-] ShowConsoleInput.cc
[edit]
[-] MouseInputNotes.txt
[edit]
[-] DebugClient.py
[edit]
[-] ScreenBufferTest2.cc
[edit]
[-] Win10WrapTest1.cc
[edit]
[-] VeryLargeRead.cc
[edit]
[-] FormatChar.h
[edit]
[-] ChangeScreenBuffer.cc
[edit]
[-] IdentifyConsoleWindow.ps1
[edit]
[-] DumpLines.py
[edit]
[-] EnableExtendedFlags.txt
[edit]
[-] TestUtil.cc
[edit]
[-] MoveConsoleWindow.cc
[edit]
[-] ClearConsole.cc
[edit]
[-] IsNewConsole.cc
[edit]
[-] ConoutMode.cc
[edit]
[-] SetWindowRect.cc
[edit]
[-] ConinMode.cc
[edit]
[-] WindowsBugCrashReader.cc
[edit]
[-] WriteConsole.cc
[edit]
[-] UnicodeWideTest1.cc
[edit]
[-] Notes.txt
[edit]
[-] Win32Test2.cc
[edit]
[-] ScreenBufferFreezeInactive.cc
[edit]
[-] GetConsolePos.cc
[edit]
[-] VkEscapeTest.cc
[edit]
[-] Win32Test1.cc
[edit]
[-] winbug-15048.cc
[edit]
[-] Win32Write1.cc
[edit]
[-] ScreenBufferTest.cc
[edit]
[-] OSVersion.cc
[edit]
[-] BufferResizeTests.cc
[edit]
[-] Spew.py
[edit]
[-] build32.sh
[edit]
[-] build64.sh
[edit]
[-] SetFont.cc
[edit]
[-] SelectAllTest.cc
[edit]
[-] UnixEcho.cc
[edit]
[-] ConinMode.ps1
[edit]
[-] Utf16Echo.cc
[edit]
[-] UnicodeWideTest2.cc
[edit]
[-] FontSurvey.cc
[edit]
[-] GetCh.cc
[edit]
[-] Win10WrapTest2.cc
[edit]
[-] Win32Echo2.cc
[edit]
[-] Win32Test3.cc
[edit]
[-] Win10ResizeWhileFrozen.cc
[edit]