]> git.tuebingen.mpg.de Git - adu.git/blobdiff - interactive.c
select.c: Fix two return values.
[adu.git] / interactive.c
index 62ff5edb774ded49b643e14c4a94f72336f4115c..9460877e344e8f8452b0f0d20f1d6ceef83dd39e 100644 (file)
@@ -2,14 +2,24 @@
 
 #include "adu.h"
 #include "format.h"
-#include "select.h"
+#include "user.h"
 #include "string.h"
+#include "select.cmdline.h"
+#include "select.h"
 #include "error.h"
-#include "cmdline.h"
 
+/**
+ * Describes one valid command for interactive mode.
+ *
+ * When invoked in interactive mode, adu reads commands from stdin. There's a
+ * static array of all such commands.
+ */
 struct interactive_command {
+       /** The name of the command. */
        const char *name;
+       /** Pointer to The function that is being executed. */
        int (*handler)(char *);
+       /** Help text. */
        const char *desc;
 };
 
@@ -65,7 +75,9 @@ static int icom_help(__a_unused char *line)
 
 void print_interactive_help(void)
 {
-       icom_help(NULL);
+       struct interactive_command *c;
+       FOR_EACH_COMMAND(c)
+               fprintf(stdout, "\t%s\t%s\n", c->name, c->desc);
 }
 
 static int icom_reset(__a_unused char *line)