]> git.tuebingen.mpg.de Git - tfortune.git/blobdiff - tfortune.c
Fix --basedir completion.
[tfortune.git] / tfortune.c
index e5b2061f22f5d537e14f5e8282013c042aa301f6..e11c6da7556e7f2b613b1be7829bc3914b8d62a6 100644 (file)
@@ -216,7 +216,7 @@ static int read_tag_expression(struct iovec *result)
        return ret;
 }
 
-static int tx2ast(struct iovec *tx, struct txp_context **ast)
+static int tx2ast(const struct iovec *tx, struct txp_context **ast)
 {
        int ret;
        char *errmsg;
@@ -335,7 +335,7 @@ static struct epi_iter *epi_iter_new(void)
                        regfile_iter_next(riter)
                ) {
                        eiter->num_maps++;
-                       eiter->maps = realloc(eiter->maps,
+                       eiter->maps = xrealloc(eiter->maps,
                                eiter->num_maps * sizeof(*eiter->maps));
                        eiter->maps[eiter->num_maps - 1] = iov;
                }
@@ -930,11 +930,11 @@ static void show_subcommand_summary(bool verbose)
                for (i = 0; i < LSG_NUM_TFORTUNE_SUBCOMMANDS; i++) {
                        if (i > 0)
                                n += printf(", ");
-                       n += printf("%s", subcommand_names[i]);
                        if (n > 70) {
                                printf("\n\t");
                                n = 8;
                        }
+                       n += printf("%s", subcommand_names[i]);
                }
                printf("\n");
        }
@@ -1448,7 +1448,7 @@ static int com_compgen(void)
                        }
                        break;
                case WT_LONG_OPT_WITH_ARG:
-                       if (strcmp(prev, "--basename") == 0) {
+                       if (strcmp(prev, "--basedir") == 0) {
                                activate_dirname_completion();
                                return 1;
                        }