UFO: Alien Invasion
|
console functions for *nix ports More...
#include "../../common/common.h"
#include "../system.h"
#include <unistd.h>
#include <signal.h>
#include <termios.h>
#include <fcntl.h>
#include <sys/time.h>
Go to the source code of this file.
Data Structures | |
struct | consoleHistory_t |
Macros | |
#define | CON_HISTORY 32 |
Functions | |
static void | CON_FlushIn (void) |
Flush stdin, I suspect some terminals are sending a LOT of shit. More... | |
static void | Sys_TTYDeleteCharacter (void) |
Output a backspace. More... | |
static void | Sys_TTYConsoleHide (void) |
Clear the display of the line currently edited bring cursor back to beginning of line. More... | |
static void | Sys_TTYConsoleShow (void) |
Show the current line. More... | |
static void | Sys_TTYConsoleHistoryAdd (consoleHistory_t *field) |
static consoleHistory_t * | Sys_TTYConsoleHistoryPrevious (void) |
static consoleHistory_t * | Sys_TTYConsoleHistoryNext (void) |
static void | Sys_TTYConsoleSigCont (int signum) |
Reinitialize console input after receiving SIGCONT, as on Linux the terminal seems to lose all set attributes if user did CTRL+Z and then does fg again. More... | |
void | Sys_ShowConsole (bool show) |
void | Sys_ConsoleShutdown (void) |
Shutdown the console. More... | |
static void | Sys_TTYConsoleHistoryClear (consoleHistory_t *edit) |
static bool | Sys_IsATTY (void) |
void | Sys_ConsoleInit (void) |
Initialize the console input (tty mode if possible) More... | |
const char * | Sys_ConsoleInput (void) |
void | Sys_ConsoleOutput (const char *string) |
Variables | |
static bool | stdinActive |
static bool | ttyConsoleActivated = false |
static int | TTY_erase |
static int | TTY_eof |
static struct termios | TTY_tc |
static consoleHistory_t | ttyConsoleHistory |
static consoleHistory_t | ttyEditLines [CON_HISTORY] |
static int | histCurrent = -1 |
static int | histCount = 0 |
console functions for *nix ports
Definition in file unix_console.cpp.
#define CON_HISTORY 32 |
Definition at line 53 of file unix_console.cpp.
Referenced by Sys_TTYConsoleHistoryNext().
Flush stdin, I suspect some terminals are sending a LOT of shit.
Definition at line 61 of file unix_console.cpp.
References key.
Referenced by Sys_ConsoleInput().
Initialize the console input (tty mode if possible)
Definition at line 217 of file unix_console.cpp.
References Com_Printf(), stdinActive, Sys_IsATTY(), Sys_TTYConsoleHistoryClear(), Sys_TTYConsoleSigCont(), TTY_eof, TTY_erase, TTY_tc, and ttyConsoleActivated.
Referenced by Sys_TTYConsoleSigCont().
const char* Sys_ConsoleInput | ( | void | ) |
Definition at line 263 of file unix_console.cpp.
References consoleHistory_t::buffer, Com_ConsoleCompleteCommand(), CON_FlushIn(), consoleHistory_t::cursor, key, len, Q_strncpyz(), stdinActive, Sys_ShowConsole(), Sys_TTYConsoleHistoryAdd(), Sys_TTYConsoleHistoryClear(), Sys_TTYConsoleHistoryNext(), Sys_TTYConsoleHistoryPrevious(), Sys_TTYDeleteCharacter(), TTY_erase, and ttyConsoleActivated.
void Sys_ConsoleOutput | ( | const char * | string | ) |
Definition at line 382 of file unix_console.cpp.
Shutdown the console.
Definition at line 192 of file unix_console.cpp.
References Sys_TTYDeleteCharacter(), TTY_tc, and ttyConsoleActivated.
|
static |
Definition at line 208 of file unix_console.cpp.
References Q_streq.
Referenced by Sys_ConsoleInit().
void Sys_ShowConsole | ( | bool | show | ) |
Definition at line 169 of file unix_console.cpp.
References Sys_TTYConsoleHide(), Sys_TTYConsoleShow(), and ttyConsoleActivated.
Referenced by Sys_ConsoleInput().
Clear the display of the line currently edited bring cursor back to beginning of line.
Definition at line 88 of file unix_console.cpp.
References consoleHistory_t::cursor, i, and Sys_TTYDeleteCharacter().
Referenced by Sys_ShowConsole().
|
static |
Definition at line 111 of file unix_console.cpp.
References field, histCount, histCurrent, i, and lengthof.
Referenced by Sys_ConsoleInput().
|
static |
Definition at line 203 of file unix_console.cpp.
References OBJZERO.
Referenced by Sys_ConsoleInit(), and Sys_ConsoleInput().
|
static |
Definition at line 145 of file unix_console.cpp.
References CON_HISTORY, histCount, and histCurrent.
Referenced by Sys_ConsoleInput().
|
static |
Definition at line 130 of file unix_console.cpp.
References histCount, histCurrent, and lengthof.
Referenced by Sys_ConsoleInput().
Show the current line.
Definition at line 101 of file unix_console.cpp.
References consoleHistory_t::buffer, consoleHistory_t::cursor, and i.
Referenced by Sys_ShowConsole().
Reinitialize console input after receiving SIGCONT, as on Linux the terminal seems to lose all set attributes if user did CTRL+Z and then does fg again.
Definition at line 164 of file unix_console.cpp.
References Sys_ConsoleInit().
Referenced by Sys_ConsoleInit().
Output a backspace.
'\b'
is not enough so instead we send "\\b \\b"
'\b'
alone would work though Definition at line 74 of file unix_console.cpp.
References key.
Referenced by Sys_ConsoleInput(), Sys_ConsoleShutdown(), and Sys_TTYConsoleHide().
|
static |
Definition at line 55 of file unix_console.cpp.
Referenced by Sys_TTYConsoleHistoryAdd(), Sys_TTYConsoleHistoryNext(), and Sys_TTYConsoleHistoryPrevious().
|
static |
Definition at line 55 of file unix_console.cpp.
Referenced by Sys_TTYConsoleHistoryAdd(), Sys_TTYConsoleHistoryNext(), and Sys_TTYConsoleHistoryPrevious().
|
static |
Definition at line 39 of file unix_console.cpp.
Referenced by Sys_ConsoleInit(), and Sys_ConsoleInput().
|
static |
Definition at line 45 of file unix_console.cpp.
Referenced by Sys_ConsoleInit().
|
static |
Definition at line 44 of file unix_console.cpp.
Referenced by Sys_ConsoleInit(), and Sys_ConsoleInput().
|
static |
Definition at line 47 of file unix_console.cpp.
Referenced by Sys_ConsoleInit(), and Sys_ConsoleShutdown().
|
static |
Definition at line 41 of file unix_console.cpp.
Referenced by Sys_ConsoleInit(), Sys_ConsoleInput(), Sys_ConsoleShutdown(), and Sys_ShowConsole().
|
static |
Definition at line 49 of file unix_console.cpp.
|
static |
Definition at line 54 of file unix_console.cpp.