[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] Changes to pspp/src/command.c
From: |
John Darrington |
Subject: |
[Pspp-cvs] Changes to pspp/src/command.c |
Date: |
Sat, 05 Feb 2005 07:42:59 -0500 |
Index: pspp/src/command.c
diff -u pspp/src/command.c:1.18 pspp/src/command.c:1.19
--- pspp/src/command.c:1.18 Mon Nov 15 09:51:22 2004
+++ pspp/src/command.c Sat Feb 5 12:42:57 2005
@@ -79,6 +79,47 @@
#undef DEFCMD
#undef UNIMPL
+
+/* Complete the line using the name of a command,
+ * based upon the current prg_state
+ */
+char *
+pspp_completion_function (const char *text, int state)
+{
+ static int skip=0;
+ const struct command *cmd = 0;
+
+ for(;;)
+ {
+ if ( state + skip >= sizeof(commands)/ sizeof(struct command))
+ {
+ skip = 0;
+ return 0;
+ }
+
+ cmd = &commands[state + skip];
+
+ if ( cmd->transition[pgm_state] == STATE_ERROR )
+ {
+ skip++;
+ continue;
+ }
+
+ if ( text == 0 || 0 == strncasecmp (cmd->name, text, strlen(text)))
+ {
+ break;
+ }
+
+ skip++;
+ }
+
+
+ return xstrdup(cmd->name);
+
+}
+
+
+
#define COMMAND_CNT (sizeof commands / sizeof *commands)
/* Command parser. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] Changes to pspp/src/command.c,
John Darrington <=