diff options
Diffstat (limited to 'mpiosh')
-rw-r--r-- | mpiosh/global.c | 4 | ||||
-rw-r--r-- | mpiosh/readline.c | 25 | ||||
-rw-r--r-- | mpiosh/readline.h | 3 |
3 files changed, 28 insertions, 4 deletions
diff --git a/mpiosh/global.c b/mpiosh/global.c index 0047627..e1215f1 100644 --- a/mpiosh/global.c +++ b/mpiosh/global.c @@ -2,7 +2,7 @@ * * Author: Andreas Buesching <crunchy@tzi.de> * - * $Id: global.c,v 1.11 2003/04/19 23:58:02 germeier Exp $ + * $Id: global.c,v 1.12 2003/04/23 08:34:15 crunchy Exp $ * * Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de> * @@ -125,7 +125,7 @@ struct mpiosh_cmd_t commands[] = { mpiosh_cmd_health, NULL }, { "id3", NULL, "[<on|off>]", " enable/disable ID3 rewriting support", - mpiosh_cmd_id3, NULL }, + mpiosh_cmd_id3, mpiosh_readline_comp_onoff }, { "id3_format", NULL, "[<format>]", " define/show the format line for ID3 rewriting", mpiosh_cmd_id3_format, NULL }, 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; diff --git a/mpiosh/readline.h b/mpiosh/readline.h index f4deb13..a0bb08a 100644 --- a/mpiosh/readline.h +++ b/mpiosh/readline.h @@ -2,7 +2,7 @@ * * Author: Andreas Büsching <crunchy@tzi.de> * - * $Id: readline.h,v 1.2 2002/10/18 08:39:23 crunchy Exp $ + * $Id: readline.h,v 1.3 2003/04/23 08:34:16 crunchy Exp $ * * Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de> * @@ -38,6 +38,7 @@ void mpiosh_readline_pipe(void); int mpiosh_readline_cancel(void); char *mpiosh_readline_comp_cmd(const char *text, int state); +char *mpiosh_readline_comp_onoff(const char *text, int state); char *mpiosh_readline_comp_mpio_file(const char *text, int state); char *mpiosh_readline_comp_config(const char *text, int state); |