From 504b523d94543a7bb7301a3b1bfe929aabf7fb36 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Sat, 25 Dec 2010 19:11:36 +0100 Subject: [PATCH] cmdline: rename return values of vt100 Signed-off-by: Olivier Matz --- src/lib/cmdline_rdline.c | 4 ++-- src/lib/cmdline_vt100.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/cmdline_rdline.c b/src/lib/cmdline_rdline.c index 2ad9a76..5783d65 100644 --- a/src/lib/cmdline_rdline.c +++ b/src/lib/cmdline_rdline.c @@ -212,10 +212,10 @@ rdline_char_in(struct rdline *rdl, char c) return RDLINE_RES_NOT_RUNNING; cmd = vt100_parser(&rdl->vt100, c); - if (cmd == -2) + if (cmd == VT100_NOT_COMPLETE) return RDLINE_RES_SUCCESS; - if (cmd >= 0) { + if (cmd != VT100_STD_CHAR) { switch (cmd) { case CMDLINE_KEY_CTRL_B: case CMDLINE_KEY_LEFT_ARR: diff --git a/src/lib/cmdline_vt100.h b/src/lib/cmdline_vt100.h index 4d64bfc..824bed3 100644 --- a/src/lib/cmdline_vt100.h +++ b/src/lib/cmdline_vt100.h @@ -133,10 +133,12 @@ struct cmdline_vt100 { */ void vt100_init(struct cmdline_vt100 *vt); +#define VT100_STD_CHAR -1 +#define VT100_NOT_COMPLETE -2 /** * Input a new character. - * Return -1 if the character is not part of a control sequence - * Return -2 if c is not the last char of a control sequence + * Return VT100_STD_CHAR if the character is not part of a control sequence + * Return VT100_NOT_COMPLETE if c is not the last char of a control sequence * Else return the index in vt100_commands[] */ int vt100_parser(struct cmdline_vt100 *vt, char c); -- 2.20.1