Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/less/ttyin.c
Show All 25 Lines | |||||
public int tty; | public int tty; | ||||
extern int sigs; | extern int sigs; | ||||
extern int utf_mode; | extern int utf_mode; | ||||
/* | /* | ||||
* Open keyboard for input. | * Open keyboard for input. | ||||
*/ | */ | ||||
public void | public void | ||||
open_getchr() | open_getchr(void) | ||||
{ | { | ||||
#if MSDOS_COMPILER==WIN32C | #if MSDOS_COMPILER==WIN32C | ||||
/* Need this to let child processes inherit our console handle */ | /* Need this to let child processes inherit our console handle */ | ||||
SECURITY_ATTRIBUTES sa; | SECURITY_ATTRIBUTES sa; | ||||
memset(&sa, 0, sizeof(SECURITY_ATTRIBUTES)); | memset(&sa, 0, sizeof(SECURITY_ATTRIBUTES)); | ||||
sa.nLength = sizeof(SECURITY_ATTRIBUTES); | sa.nLength = sizeof(SECURITY_ATTRIBUTES); | ||||
sa.bInheritHandle = TRUE; | sa.bInheritHandle = TRUE; | ||||
tty = (int) CreateFile("CONIN$", GENERIC_READ, | tty = (int) CreateFile("CONIN$", GENERIC_READ, | ||||
Show All 37 Lines | |||||
#endif | #endif | ||||
#endif | #endif | ||||
} | } | ||||
/* | /* | ||||
* Close the keyboard. | * Close the keyboard. | ||||
*/ | */ | ||||
public void | public void | ||||
close_getchr() | close_getchr(void) | ||||
{ | { | ||||
#if MSDOS_COMPILER==WIN32C | #if MSDOS_COMPILER==WIN32C | ||||
SetConsoleMode((HANDLE)tty, console_mode); | SetConsoleMode((HANDLE)tty, console_mode); | ||||
CloseHandle((HANDLE)tty); | CloseHandle((HANDLE)tty); | ||||
#endif | #endif | ||||
} | } | ||||
/* | /* | ||||
* Get a character from the keyboard. | * Get a character from the keyboard. | ||||
*/ | */ | ||||
public int | public int | ||||
getchr() | getchr(void) | ||||
{ | { | ||||
char c; | char c; | ||||
int result; | int result; | ||||
do | do | ||||
{ | { | ||||
#if MSDOS_COMPILER && MSDOS_COMPILER != DJGPPC | #if MSDOS_COMPILER && MSDOS_COMPILER != DJGPPC | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |