diff options
Diffstat (limited to 'mpiosh/readline.c')
-rw-r--r-- | mpiosh/readline.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/mpiosh/readline.c b/mpiosh/readline.c index d10209b..afc78c0 100644 --- a/mpiosh/readline.c +++ b/mpiosh/readline.c @@ -2,7 +2,7 @@ * * Author: Andreas Büsching <crunchy@tzi.de> * - * $Id: readline.c,v 1.6 2003/04/06 23:09:20 germeier Exp $ + * $Id: readline.c,v 1.7 2003/04/23 08:34:16 crunchy Exp $ * * Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de> * @@ -39,6 +39,29 @@ mpiosh_readline_init(void) } char * +mpiosh_readline_comp_onoff(const char *text, int state) +{ + static const char * states[] = { "on", "off", NULL }; + static const char ** st = states; + const char * ret = NULL; + + if (state == 0) { + st = states; + } + + while (*st) { + if (!strncmp(text, *st, strlen(text))) { + ret = *st; + st++; + break; + } + st++; + } + + return (ret ? strdup(ret) : NULL); +} + +char * mpiosh_readline_comp_cmd(const char *text, int state) { static struct mpiosh_cmd_t *cmd = NULL; |