#include <termios.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include "linenoise.h"
Go to the source code of this file.
Compounds | |
struct | abuf |
struct | linenoiseState |
Defines | |
#define | LINENOISE_DEFAULT_HISTORY_MAX_LEN 100 |
#define | LINENOISE_MAX_LINE 4096 |
#define | lndebug(fmt,) |
#define | LINENOISE_HISTORY_NEXT 0 |
#define | LINENOISE_HISTORY_PREV 1 |
Enumerations | |
enum | KEY_ACTION { KEY_NULL = 0, CTRL_A = 1, CTRL_B = 2, CTRL_C = 3, CTRL_D = 4, CTRL_E = 5, CTRL_F = 6, CTRL_H = 8, TAB = 9, CTRL_K = 11, CTRL_L = 12, ENTER = 13, CTRL_N = 14, CTRL_P = 16, CTRL_T = 20, CTRL_U = 21, CTRL_W = 23, ESC = 27, BACKSPACE = 127 } |
Functions | |
void | linenoiseAtExit (void) |
int | linenoiseHistoryAdd (const char *line) |
void | refreshLine (struct linenoiseState *l) |
void | linenoiseMaskModeEnable (void) |
void | linenoiseMaskModeDisable (void) |
void | linenoiseSetMultiLine (int ml) |
int | isUnsupportedTerm (void) |
int | enableRawMode (int fd, int flush) |
void | disableRawMode (int fd, int flush) |
int | getCursorPosition (int ifd, int ofd) |
int | getColumns (int ifd, int ofd) |
void | linenoiseClearScreen (void) |
void | linenoiseBeep (void) |
void | freeCompletions (linenoiseCompletions *lc) |
int | completeLine (struct linenoiseState *ls) |
void | linenoiseSetCompletionCallback (void *uctx, linenoiseCompletionCallback *fn) |
void | linenoiseSetHintsCallback (void *uctx, linenoiseHintsCallback *fn) |
void | linenoiseSetFreeHintsCallback (void *uctx, linenoiseFreeHintsCallback *fn) |
void | linenoiseAddCompletion (linenoiseCompletions *lc, const char *str) |
void | abInit (struct abuf *ab) |
void | abAppend (struct abuf *ab, const char *s, int len) |
void | abFree (struct abuf *ab) |
void | refreshShowHints (struct abuf *ab, struct linenoiseState *l, int plen) |
void | refreshSingleLine (struct linenoiseState *l) |
void | refreshMultiLine (struct linenoiseState *l) |
int | linenoiseEditInsert (struct linenoiseState *l, char c) |
void | linenoiseEditMoveLeft (struct linenoiseState *l) |
void | linenoiseEditMoveRight (struct linenoiseState *l) |
void | linenoiseEditMoveHome (struct linenoiseState *l) |
void | linenoiseEditMoveEnd (struct linenoiseState *l) |
void | linenoiseEditHistoryNext (struct linenoiseState *l, int dir) |
void | linenoiseEditDelete (struct linenoiseState *l) |
void | linenoiseEditBackspace (struct linenoiseState *l) |
void | linenoiseEditDeletePrevWord (struct linenoiseState *l) |
int | linenoiseEdit (int stdin_fd, int stdout_fd, char *buf, size_t buflen, const char *prompt) |
void | linenoisePrintKeyCodes (void) |
int | linenoiseRaw (char *buf, size_t buflen, const char *prompt) |
char * | linenoiseNoTTY (void) |
char * | linenoise (const char *prompt) |
void | linenoiseFree (void *ptr) |
void | freeHistory (void) |
int | linenoiseHistorySetMaxLen (int len) |
int | linenoiseHistorySave (const char *filename) |
int | linenoiseHistoryLoad (const char *filename) |
Variables | |
char * | unsupported_term [] = {"dumb","cons25","emacs",NULL} |
linenoiseCompletionCallback * | completionCallback = NULL |
void * | completionCallbackCtx = NULL |
linenoiseHintsCallback * | hintsCallback = NULL |
void * | hintsCallbackCtx = NULL |
linenoiseFreeHintsCallback * | freeHintsCallback = NULL |
void * | freeHintsCallbackCtx = NULL |
termios | orig_termios |
int | maskmode = 0 |
int | rawmode = 0 |
int | mlmode = 0 |
int | atexit_registered = 0 |
int | history_max_len = LINENOISE_DEFAULT_HISTORY_MAX_LEN |
int | history_len = 0 |
char ** | history = NULL |
|
Definition at line 140 of file linenoise.c. |
|
Definition at line 750 of file linenoise.c. Referenced by linenoiseEdit. |
|
Definition at line 751 of file linenoise.c. Referenced by linenoiseEdit, and linenoiseEditHistoryNext. |
|
Definition at line 141 of file linenoise.c. Referenced by linenoise, and linenoiseHistoryLoad. |
|
Definition at line 219 of file linenoise.c. Referenced by refreshMultiLine. |
|
Definition at line 177 of file linenoise.c. |
|
Definition at line 501 of file linenoise.c. References abuf::b, abuf::len, and NULL. Referenced by refreshMultiLine, refreshShowHints, and refreshSingleLine. |
|
Definition at line 510 of file linenoise.c. References abuf::b. Referenced by refreshMultiLine, and refreshSingleLine. |
|
Definition at line 496 of file linenoise.c. References abuf::b, abuf::len, and NULL. Referenced by refreshMultiLine, and refreshSingleLine. |
|
Definition at line 387 of file linenoise.c. References linenoiseState::buf, linenoiseState::buflen, completionCallback, completionCallbackCtx, linenoiseCompletions::cvec, freeCompletions, linenoiseState::ifd, linenoiseState::len, linenoiseCompletions::len, linenoiseBeep, NULL, linenoiseState::pos, and refreshLine. Referenced by linenoiseEdit. |
|
Definition at line 290 of file linenoise.c. References orig_termios, and rawmode. |
|
Definition at line 255 of file linenoise.c. References atexit_registered, ECHO, linenoiseAtExit, orig_termios, and rawmode. |
|
Definition at line 373 of file linenoise.c. References linenoiseCompletions::cvec, linenoiseCompletions::len, and NULL. Referenced by completeLine. |
|
Definition at line 1129 of file linenoise.c. References history, and history_len. Referenced by linenoiseAtExit. |
|
Definition at line 323 of file linenoise.c. References getCursorPosition. Referenced by linenoiseEdit. |
|
Definition at line 299 of file linenoise.c. References ESC. Referenced by getColumns. |
|
Definition at line 244 of file linenoise.c. References NULL, and unsupported_term. Referenced by linenoise. |
|
Definition at line 1090 of file linenoise.c. References isUnsupportedTerm, LINENOISE_MAX_LINE, linenoiseNoTTY, linenoiseRaw, and NULL. |
|
Definition at line 469 of file linenoise.c. References linenoiseCompletions::cvec, linenoiseCompletions::len, and NULL. |
|
Definition at line 1140 of file linenoise.c. References disableRawMode, and freeHistory. Referenced by enableRawMode. |
|
Definition at line 365 of file linenoise.c. Referenced by completeLine. |
|
Definition at line 357 of file linenoise.c. Referenced by linenoiseEdit. |
|
|
Definition at line 786 of file linenoise.c. References linenoiseState::buf, linenoiseState::len, linenoiseState::pos, and refreshLine. Referenced by linenoiseEdit. |
|
Definition at line 776 of file linenoise.c. References linenoiseState::buf, linenoiseState::len, linenoiseState::pos, and refreshLine. Referenced by linenoiseEdit. |
|
Definition at line 798 of file linenoise.c. References linenoiseState::buf, linenoiseState::len, linenoiseState::pos, and refreshLine. Referenced by linenoiseEdit. |
|
Definition at line 752 of file linenoise.c. References linenoiseState::buf, linenoiseState::buflen, history, linenoiseState::history_index, history_len, linenoiseState::len, LINENOISE_HISTORY_PREV, linenoiseState::pos, and refreshLine. Referenced by linenoiseEdit. |
|
Definition at line 689 of file linenoise.c. References linenoiseState::buf, linenoiseState::buflen, linenoiseState::cols, hintsCallback, linenoiseState::len, maskmode, mlmode, linenoiseState::ofd, linenoiseState::plen, linenoiseState::pos, and refreshLine. Referenced by linenoiseEdit. |
|
Definition at line 741 of file linenoise.c. References linenoiseState::len, linenoiseState::pos, and refreshLine. Referenced by linenoiseEdit. |
|
Definition at line 733 of file linenoise.c. References linenoiseState::pos, and refreshLine. Referenced by linenoiseEdit. |
|
Definition at line 717 of file linenoise.c. References linenoiseState::pos, and refreshLine. Referenced by linenoiseEdit. |
|
Definition at line 725 of file linenoise.c. References linenoiseState::len, linenoiseState::pos, and refreshLine. Referenced by linenoiseEdit. |
|
Definition at line 1121 of file linenoise.c. |
|
Definition at line 1152 of file linenoise.c. References history, history_len, history_max_len, and NULL. |
|
Definition at line 1235 of file linenoise.c. References LINENOISE_MAX_LINE, linenoiseHistoryAdd, and NULL. |
|
Definition at line 1215 of file linenoise.c. References history, history_len, and NULL. |
|
Definition at line 1185 of file linenoise.c. References history, history_len, history_max_len, and NULL. |
|
Definition at line 233 of file linenoise.c. References maskmode. |
|
Definition at line 228 of file linenoise.c. References maskmode. |
|
Definition at line 1054 of file linenoise.c. References NULL. Referenced by linenoise. |
|
Definition at line 1007 of file linenoise.c. References disableRawMode, and enableRawMode. |
|
Definition at line 1034 of file linenoise.c. References disableRawMode, enableRawMode, and linenoiseEdit. Referenced by linenoise. |
|
Definition at line 446 of file linenoise.c. References completionCallback, and completionCallbackCtx. |
|
Definition at line 460 of file linenoise.c. References freeHintsCallback, and freeHintsCallbackCtx. |
|
Definition at line 453 of file linenoise.c. References hintsCallback, hintsCallbackCtx, and linenoiseHintsCallback. |
|
Definition at line 238 of file linenoise.c. References mlmode. |
|
Definition at line 679 of file linenoise.c. References refreshMultiLine, and refreshSingleLine. Referenced by completeLine, linenoiseEdit, linenoiseEditBackspace, linenoiseEditDelete, linenoiseEditDeletePrevWord, linenoiseEditHistoryNext, linenoiseEditInsert, linenoiseEditMoveEnd, linenoiseEditMoveHome, linenoiseEditMoveLeft, and linenoiseEditMoveRight. |
|
Definition at line 589 of file linenoise.c. References abAppend, abFree, abInit, abuf::b, linenoiseState::buf, linenoiseState::cols, abuf::len, linenoiseState::len, lndebug, maskmode, linenoiseState::maxrows, linenoiseState::ofd, linenoiseState::oldpos, linenoiseState::pos, linenoiseState::prompt, and refreshShowHints. Referenced by refreshLine. |
|
Definition at line 516 of file linenoise.c. References abAppend, linenoiseState::buf, linenoiseState::cols, freeHintsCallback, freeHintsCallbackCtx, hintsCallback, hintsCallbackCtx, and linenoiseState::len. Referenced by refreshMultiLine, and refreshSingleLine. |
|
Definition at line 544 of file linenoise.c. References abAppend, abFree, abInit, abuf::b, linenoiseState::buf, linenoiseState::cols, abuf::len, linenoiseState::len, maskmode, linenoiseState::ofd, linenoiseState::pos, linenoiseState::prompt, and refreshShowHints. Referenced by refreshLine. |
|
Definition at line 154 of file linenoise.c. Referenced by enableRawMode. |
|
Definition at line 143 of file linenoise.c. Referenced by completeLine, linenoiseEdit, and linenoiseSetCompletionCallback. |
|
Definition at line 144 of file linenoise.c. Referenced by completeLine, and linenoiseSetCompletionCallback. |
|
Definition at line 147 of file linenoise.c. Referenced by linenoiseSetFreeHintsCallback, and refreshShowHints. |
|
Definition at line 148 of file linenoise.c. Referenced by linenoiseSetFreeHintsCallback, and refreshShowHints. |
|
Definition at line 145 of file linenoise.c. Referenced by linenoiseEdit, linenoiseEditInsert, linenoiseSetHintsCallback, and refreshShowHints. |
|
Definition at line 146 of file linenoise.c. Referenced by linenoiseSetHintsCallback, and refreshShowHints. |
|
Definition at line 157 of file linenoise.c. Referenced by freeHistory, linenoiseEdit, linenoiseEditHistoryNext, linenoiseHistoryAdd, linenoiseHistorySave, and linenoiseHistorySetMaxLen. |
|
Definition at line 156 of file linenoise.c. Referenced by freeHistory, linenoiseEdit, linenoiseEditHistoryNext, linenoiseHistoryAdd, linenoiseHistorySave, and linenoiseHistorySetMaxLen. |
|
Definition at line 155 of file linenoise.c. Referenced by linenoiseHistoryAdd, and linenoiseHistorySetMaxLen. |
|
Definition at line 151 of file linenoise.c. Referenced by linenoiseEditInsert, linenoiseMaskModeDisable, linenoiseMaskModeEnable, refreshMultiLine, and refreshSingleLine. |
|
Definition at line 153 of file linenoise.c. Referenced by linenoiseEditInsert, and linenoiseSetMultiLine. |
|
Definition at line 150 of file linenoise.c. Referenced by disableRawMode, and enableRawMode. |
|
Definition at line 152 of file linenoise.c. Referenced by disableRawMode, and enableRawMode. |
|
Definition at line 142 of file linenoise.c. Referenced by isUnsupportedTerm. |