]> git.tuebingen.mpg.de Git - tfortune.git/blobdiff - tfortune.c
com_stats(): Avoid division by zero.
[tfortune.git] / tfortune.c
index 29243fc764f02533e7390e585a45d1f8b74d51d1..ec4c323f7c29040b0bbb7d1e883f303c6559951c 100644 (file)
@@ -895,11 +895,11 @@ static int com_stats(void)
        printf("number of tags..................... %5lu\n", num_tags);
        printf("number of unique tags.............. %5u\n", num_unique_tags);
        printf("average number of epigrams per file %8.02f\n",
-               (float)num_epis / num_epi_files);
-       printf("average number of tags per epigram. %8.02f\n",
-               (float)num_tags / num_epis);
-       printf("average number of tag recurrence... %8.02f\n",
-               (float)num_tags / num_unique_tags);
+               num_epi_files > 0?  (float)num_epis / num_epi_files : 0);
+       printf("average number of tags per epigram. %8.02f\n", num_epis > 0?
+               (float)num_tags / num_epis : 0);
+       printf("average number of tag recurrence... %8.02f\n", num_unique_tags > 0?
+               (float)num_tags / num_unique_tags : 0);
        if (verbose) {
                printf("\nlinear hashing statistics:\n%s\n", lh_stats);
                free(lh_stats);
@@ -969,6 +969,7 @@ static int com_help(void)
 }
 EXPORT_CMD_HANDLER(help);
 
+const char *GET_VERSION(void);
 static void handle_help_and_version(void)
 {
        int i;
@@ -976,14 +977,19 @@ static void handle_help_and_version(void)
        const struct lls_command *cmd;
 
        if (OPT_GIVEN(TFORTUNE, VERSION)) {
-               printf("tfortune %s\n"
+               printf(PACKAGE " %s\n"
                        "Copyright (C) " COPYRIGHT_YEAR " " AUTHOR ".\n"
-                       "License " LICENSE ": <" LICENSE_URL ">.\n"
+                       "License: " LICENSE ": <" LICENSE_URL ">.\n"
                        "This is free software: you are free to change and redistribute it.\n"
                        "There is NO WARRANTY, to the extent permitted by law.\n"
-                       "Report bugs to " AUTHOR " <" PACKAGE_BUGREPORT ">.\n"
+                       "\n"
+                       "Web page: " PACKAGE_HOMEPAGE "\n"
+                       "Clone URL: " CLONE_URL "\n"
+                       "Gitweb: " GITWEB_URL "\n"
+                       "Author's Home Page: " HOME_URL "\n"
+                       "Send feedback to: " AUTHOR " <" EMAIL ">\n"
                        ,
-                       tf_version()
+                       GET_VERSION()
                );
                exit(EXIT_SUCCESS);
        }
@@ -1448,7 +1454,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;
                        }