--- /dev/null
+/*
+ * Copyright (C) 2015-2016 Thadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#define _GNU_SOURCE
+#include "sistema.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+#include "cmd.h"
+#include "util.h"
+
+static const char *helpdir = "help";
+
+static int run_help(struct declaracao *dec, char **args, int argc)
+{
+ int r;
+ char *filename;
+ char *basename;
+ if (argc == 1)
+ basename = "help";
+ else if (argc == 2)
+ basename = args[1];
+ else
+ return -EINVAL;
+ r = asprintf(&filename, "%s/%s.txt", helpdir, basename);
+ if (r < 0) {
+ return -errno;
+ }
+ printf("\n");
+ dumpfile(1, filename);
+ printf("\n");
+ free(filename);
+ return 0;
+}
+
+static struct cmd cmd_help = {
+ .name = "help",
+ .run = run_help,
+};
+
+static struct cmd cmd_ajuda = {
+ .name = "ajuda",
+ .run = run_help,
+};
+
+int help_cmd_init(void)
+{
+ cmd_add(&cmd_help);
+ cmd_add(&cmd_ajuda);
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (C) 2015-2016 Thadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _HELP_H
+#define _HELP_H
+
+int help_cmd_init(void);
+
+#endif