aboutsummaryrefslogtreecommitdiff
path: root/mpiosh/readline.c
diff options
context:
space:
mode:
authorcrunchy <crunchy>2002-10-29 20:03:33 +0000
committercrunchy <crunchy>2002-10-29 20:03:33 +0000
commitc7351455575348d9d9847604069ee15132f2d8e0 (patch)
tree042afb35dc47c212456af5a5543c2c4e65763463 /mpiosh/readline.c
parent037e02905b802686be908d4f8cd989f0c5002b99 (diff)
downloadmpiosh-c7351455575348d9d9847604069ee15132f2d8e0.tar.gz
mpiosh-c7351455575348d9d9847604069ee15132f2d8e0.tar.bz2
mpiosh-c7351455575348d9d9847604069ee15132f2d8e0.zip
a special crunchy checkin: no testing;-)
Diffstat (limited to 'mpiosh/readline.c')
-rw-r--r--mpiosh/readline.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/mpiosh/readline.c b/mpiosh/readline.c
index cd72591..8b97219 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.4 2002/10/18 08:39:23 crunchy Exp $
+ * $Id: readline.c,v 1.5 2002/10/29 20:03:35 crunchy Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -41,10 +41,9 @@ mpiosh_readline_init(void)
char *
mpiosh_readline_comp_cmd(const char *text, int state)
{
- static mpiosh_cmd_t * cmd = NULL;
- static char ** alias = NULL;
-
- char *cmd_text = NULL;
+ static struct mpiosh_cmd_t *cmd = NULL;
+ static char **alias = NULL;
+ char *cmd_text = NULL;
if (state == 0) {
cmd = commands;
@@ -123,9 +122,17 @@ mpiosh_readline_comp_mpio_file(const char *text, int state)
char *
mpiosh_readline_comp_config(const char *text, int state)
{
- char *arg = NULL;
+ static char *args[] = { "put", "write", "show", NULL };
+ static char **arg = NULL;
+ char *res = NULL;
+
+ if (state == 0) arg = args;
+ if (*arg && (strstr(*arg, text) == *arg)) {
+ res = strdup(*arg);
+ arg++;
+ }
- return arg;
+ return res;
}
@@ -139,7 +146,7 @@ mpiosh_readline_completion(const char *text, int start, int end)
if (start == 0) /* command completion */
matches = rl_completion_matches(text, mpiosh_readline_comp_cmd);
else {
- mpiosh_cmd_t *scmd;
+ struct mpiosh_cmd_t *scmd;
char *cmd, *help= rl_line_buffer;
while (*help != ' ') help++;