#include "cmd.h"
#include "util.h"
-static const char *helpdir = "help";
+#ifndef DOCDIR
+#define DOCDIR "help"
+#endif
+
+static const char *helpdir = DOCDIR;
+
+static int help_cmds(struct declaracao *dec)
+{
+ void *iter = NULL;
+ struct cmd *cmd;
+ printf("\n");
+ while ((cmd = cmd_next(&iter)) != NULL) {
+ printf("%s - ", cmd->name);
+ if (cmd->help)
+ printf("%s", cmd->help);
+ printf("\n");
+ }
+ printf("\n");
+}
static int run_help(struct declaracao *dec, char **args, int argc)
{
char *filename;
char *basename;
if (argc == 1)
- basename = "help";
+ return help_cmds(dec);
else if (argc == 2)
basename = args[1];
else