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 |
Defines | |
#define | CON_HISTORY 32 |
Functions | |
static void | CON_FlushIn (void) |
Flush stdin, I suspect some terminals are sending a LOT of shit. | |
static void | Sys_TTYDeleteCharacter (void) |
Output a backspace. | |
static void | Sys_TTYConsoleHide (void) |
Clear the display of the line currently edited bring cursor back to beginning of line. | |
static void | Sys_TTYConsoleShow (void) |
Show the current line. | |
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. | |
void | Sys_ShowConsole (qboolean show) |
void | Sys_ConsoleShutdown (void) |
Shutdown the console. | |
static void | Sys_TTYConsoleHistoryClear (consoleHistory_t *edit) |
static qboolean | Sys_IsATTY (void) |
void | Sys_ConsoleInit (void) |
Initialize the console input (tty mode if possible). | |
const char * | Sys_ConsoleInput (void) |
void | Sys_ConsoleOutput (const char *string) |
Variables | |
static qboolean | stdinActive |
static qboolean | ttyConsoleActivated = qfalse |
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.c.
#define CON_HISTORY 32 |
Definition at line 53 of file unix_console.c.
Referenced by Sys_TTYConsoleHistoryNext().
static void CON_FlushIn | ( | void | ) | [static] |
Flush stdin, I suspect some terminals are sending a LOT of shit.
Definition at line 61 of file unix_console.c.
References key.
Referenced by Sys_ConsoleInput().
void Sys_ConsoleInit | ( | void | ) |
Initialize the console input (tty mode if possible).
Definition at line 225 of file unix_console.c.
References Com_Printf(), qfalse, qtrue, stdinActive, Sys_IsATTY(), Sys_TTYConsoleHistoryClear(), Sys_TTYConsoleSigCont(), TTY_eof, TTY_erase, TTY_tc, and ttyConsoleActivated.
const char* Sys_ConsoleInput | ( | void | ) |
Definition at line 273 of file unix_console.c.
References consoleHistory_t::buffer, Com_ConsoleCompleteCommand(), CON_FlushIn(), consoleHistory_t::cursor, key, len, Q_strncpyz(), qfalse, qtrue, 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 399 of file unix_console.c.
References COLORED_GREEN, qfalse, qtrue, and Sys_ShowConsole().
void Sys_ConsoleShutdown | ( | void | ) |
Shutdown the console.
Definition at line 200 of file unix_console.c.
References Sys_TTYDeleteCharacter(), TTY_tc, and ttyConsoleActivated.
static qboolean Sys_IsATTY | ( | void | ) | [static] |
Definition at line 216 of file unix_console.c.
Referenced by Sys_ConsoleInit().
void Sys_ShowConsole | ( | qboolean | show | ) |
Definition at line 177 of file unix_console.c.
References Sys_TTYConsoleHide(), Sys_TTYConsoleShow(), and ttyConsoleActivated.
static void Sys_TTYConsoleHide | ( | void | ) | [static] |
Clear the display of the line currently edited bring cursor back to beginning of line.
Definition at line 91 of file unix_console.c.
References consoleHistory_t::cursor, i, and Sys_TTYDeleteCharacter().
Referenced by Sys_ShowConsole().
static void Sys_TTYConsoleHistoryAdd | ( | consoleHistory_t * | field | ) | [static] |
Definition at line 116 of file unix_console.c.
References histCount, histCurrent, i, and lengthof.
Referenced by Sys_ConsoleInput().
static void Sys_TTYConsoleHistoryClear | ( | consoleHistory_t * | edit | ) | [static] |
Definition at line 211 of file unix_console.c.
Referenced by Sys_ConsoleInit(), and Sys_ConsoleInput().
static consoleHistory_t* Sys_TTYConsoleHistoryNext | ( | void | ) | [static] |
Definition at line 153 of file unix_console.c.
References CON_HISTORY, histCount, and histCurrent.
Referenced by Sys_ConsoleInput().
static consoleHistory_t* Sys_TTYConsoleHistoryPrevious | ( | void | ) | [static] |
Definition at line 136 of file unix_console.c.
References histCount, histCurrent, and lengthof.
Referenced by Sys_ConsoleInput().
static void Sys_TTYConsoleShow | ( | void | ) | [static] |
Show the current line.
Definition at line 105 of file unix_console.c.
References consoleHistory_t::buffer, consoleHistory_t::cursor, and i.
Referenced by Sys_ShowConsole().
static void Sys_TTYConsoleSigCont | ( | int | signum | ) | [static] |
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 172 of file unix_console.c.
References Sys_ConsoleInit().
Referenced by Sys_ConsoleInit().
static void Sys_TTYDeleteCharacter | ( | void | ) | [static] |
Output a backspace.
Definition at line 74 of file unix_console.c.
References key.
Referenced by Sys_ConsoleInput(), Sys_ConsoleShutdown(), and Sys_TTYConsoleHide().
int histCount = 0 [static] |
Definition at line 55 of file unix_console.c.
Referenced by Sys_TTYConsoleHistoryAdd(), Sys_TTYConsoleHistoryNext(), and Sys_TTYConsoleHistoryPrevious().
int histCurrent = -1 [static] |
Definition at line 55 of file unix_console.c.
Referenced by Sys_TTYConsoleHistoryAdd(), Sys_TTYConsoleHistoryNext(), and Sys_TTYConsoleHistoryPrevious().
qboolean stdinActive [static] |
Definition at line 39 of file unix_console.c.
Referenced by Sys_ConsoleInit(), and Sys_ConsoleInput().
int TTY_eof [static] |
Definition at line 45 of file unix_console.c.
Referenced by Sys_ConsoleInit().
int TTY_erase [static] |
Definition at line 44 of file unix_console.c.
Referenced by Sys_ConsoleInit(), and Sys_ConsoleInput().
struct termios TTY_tc [static] |
Definition at line 47 of file unix_console.c.
Referenced by Sys_ConsoleInit(), and Sys_ConsoleShutdown().
qboolean ttyConsoleActivated = qfalse [static] |
Definition at line 41 of file unix_console.c.
Referenced by Sys_ConsoleInit(), Sys_ConsoleInput(), Sys_ConsoleShutdown(), and Sys_ShowConsole().
consoleHistory_t ttyConsoleHistory [static] |
Definition at line 49 of file unix_console.c.
consoleHistory_t ttyEditLines[CON_HISTORY] [static] |
Definition at line 54 of file unix_console.c.