diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-09 06:25:21 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-09 06:25:21 -0700 |
commit | 76a770d9826c080f4d6be2cc959c3ce3e972c1b8 (patch) | |
tree | 04ac311f57c5b90ee005549a80429aee6bd6535f /linenoise | |
parent | 64ed411ed0747d1faf8284409ba858450baa2028 (diff) | |
download | txr-76a770d9826c080f4d6be2cc959c3ce3e972c1b8.tar.gz txr-76a770d9826c080f4d6be2cc959c3ce3e972c1b8.tar.bz2 txr-76a770d9826c080f4d6be2cc959c3ce3e972c1b8.zip |
linenoise: remove input-viewing debug function.
This is unused code which just addds to the executable size.
Also it passes a char to isprint, which is undefined behavior
if that char happens to be negative.
* linenoise/example.c (main): Remove --keycodes option
and reference to lino_print_keycodes function.
* linenoise/linenoise.c, linenoise/linenoise.h
(lino_print_keycodes): Function removed.
Diffstat (limited to 'linenoise')
-rw-r--r-- | linenoise/example.c | 3 | ||||
-rw-r--r-- | linenoise/linenoise.c | 28 | ||||
-rw-r--r-- | linenoise/linenoise.h | 1 |
3 files changed, 0 insertions, 32 deletions
diff --git a/linenoise/example.c b/linenoise/example.c index f884c962..fc7ae78c 100644 --- a/linenoise/example.c +++ b/linenoise/example.c @@ -35,9 +35,6 @@ int main(int argc, char **argv) { if (!strcmp(*argv,"--multiline")) { lino_set_multiline(ls, 1); printf("Multi-line mode enabled.\n"); - } else if (!strcmp(*argv,"--keycodes")) { - lino_print_keycodes(ls); - exit(0); } else { fprintf(stderr, "Usage: %s [--multiline] [--keycodes]\n", prgname); exit(1); diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index 50f7ccd1..63abef6c 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -906,34 +906,6 @@ static int edit(lino_t *l, const char *prompt) return l->len; } -/* This special mode is used by linenoise in order to print scan codes - * on screen for debugging / development purposes. It is implemented - * by the linenoise_example program using the --keycodes option. */ -void lino_print_keycodes(lino_t *l) { - char quit[4]; - - printf("Linenoise key codes debugging mode.\n" - "Press keys to see scan codes. Type 'quit' at any time to exit.\n"); - if (enable_raw_mode(l) == -1) return; - memset(quit,' ',4); - while(1) { - char c; - int nread; - - nread = read(l->ifd,&c,1); - if (nread <= 0) continue; - memmove(quit,quit+1,sizeof(quit)-1); /* shift string to left. */ - quit[sizeof(quit)-1] = c; /* Insert current char on the right. */ - if (memcmp(quit,"quit",sizeof(quit)) == 0) break; - - printf("'%c' %02x (%d) (type quit to exit)\n", - isprint(c) ? c : '?', (int)c, (int)c); - printf("\r"); /* Go left edge manually, we are in raw mode. */ - fflush(stdout); - } - disable_raw_mode(l); -} - /* The main function of the linenoise library * handles a non-TTY input file descriptor by opening * a standard I/O stream on it and reading lines diff --git a/linenoise/linenoise.h b/linenoise/linenoise.h index 0822a59b..e9fb8793 100644 --- a/linenoise/linenoise.h +++ b/linenoise/linenoise.h @@ -68,4 +68,3 @@ int lino_hist_save(lino_t *, const char *filename); int lino_hist_load(lino_t *, const char *filename); int lino_clear_screen(lino_t *); void lino_set_multiline(lino_t *, int ml); -void lino_print_keycodes(lino_t *); |