]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Improve man page layout.
authorAndre Noll <maan@systemlinux.org>
Mon, 20 May 2013 17:29:58 +0000 (19:29 +0200)
committerAndre Noll <maan@systemlinux.org>
Thu, 13 Jun 2013 16:29:03 +0000 (18:29 +0200)
This changes the output of --help, --detailed-help and --version
so that the man pages generated from this output by help2man look
much nicer.

Specifically, name and purposes are printed in a single line and
the version text now contains also build data, build system and the
compiler version.

Also the codename is no longer printed in version_single_line(),
since this caused the top and bottom labels of the man pages to
look quite ugly.

ggo.c
ggo.h
version.c

diff --git a/ggo.c b/ggo.c
index 3a441db1fa42f16d701dfa7492cf4bbaf22744f9..58d86d0796adec72bf3ea134532b9bc3c80bea07 100644 (file)
--- a/ggo.c
+++ b/ggo.c
@@ -39,10 +39,8 @@ void ggo_print_help(struct ggo_help *help, unsigned flags)
 {
        const char **p;
 
-       if (flags & GPH_PRINT_NAME_VERSION)
-               printf_or_die("%s\n", version_single_line(help->prefix));
-       if (help->purpose && (flags & GPH_PRINT_PURPOSE))
-               printf_or_die("\n%s\n", help->purpose);
+       if (help->purpose && (flags & GPH_PRINT_NAME_PURPOSE))
+               printf_or_die("para_%s - %s\n", help->prefix, help->purpose);
        if (help->usage && (flags & GPH_PRINT_USAGE))
                printf_or_die("\n%s\n", help->usage);
        if (help->description && (flags & GPH_PRINT_DESCRIPTION))
diff --git a/ggo.h b/ggo.h
index 671fc01c7f6b4269d30c7214d8ec29fef7cfb4e6..81565e7c24b50d130afd36560c4f5973973f1090 100644 (file)
--- a/ggo.h
+++ b/ggo.h
@@ -33,19 +33,17 @@ struct ggo_help {
 enum ggo_print_help_flags {
        /** Whether to print the short help or the detailed help. */
        GPH_DETAILED = 1 << 0,
-       /** Print the program or module name, git version and codename. */
-       GPH_PRINT_NAME_VERSION = 1 << 1,
+       /** Print the program or module name and the purpose text. */
+       GPH_PRINT_NAME_PURPOSE = 1 << 1,
        /** Print the synopsis. */
        GPH_PRINT_USAGE = 1 << 2,
        /** Print the description text. */
        GPH_PRINT_DESCRIPTION = 1 << 3,
-       /** Print the purpose text. */
-       GPH_PRINT_PURPOSE = 1 << 4,
 };
 
 /** Used to print the normal help of programs (--help) */
 #define GPH_STANDARD_FLAGS \
-       (GPH_PRINT_NAME_VERSION | GPH_PRINT_PURPOSE | GPH_PRINT_USAGE)
+       (GPH_PRINT_NAME_PURPOSE | GPH_PRINT_USAGE)
 
 /** Additional information for --detailed-help. */
 #define GPH_STANDARD_FLAGS_DETAILED \
index d2df4818f4cb240482e5bf48028c5d5d5fd88368..ad1334634238b749b1089cd8271e6cbf263eece1 100644 (file)
--- a/version.c
+++ b/version.c
@@ -27,7 +27,7 @@ const char *version_single_line(const char *pfx)
 {
        static char buf[100];
        snprintf(buf, sizeof(buf) - 1,
-               "para_%s " GIT_VERSION " (" CODENAME ")", pfx);
+               "para_%s " GIT_VERSION, pfx);
        return buf;
 }
 
@@ -48,11 +48,13 @@ const char *version_text(const char *pfx)
        static char buf[512];
 
        snprintf(buf, sizeof(buf) - 1, "%s\n"
-               "built: " BUILD_DATE ", " UNAME_RS ", " CC_VERSION "\n"
                "Copyright (C) 2013 Andre Noll\n"
                "This is free software with ABSOLUTELY NO WARRANTY."
                " See COPYING for details.\n"
-               "Report bugs to <maan@systemlinux.org>.\n",
+               "Report bugs to <maan@systemlinux.org>.\n"
+               "build date: " BUILD_DATE ",\n"
+               "build system: " UNAME_RS ",\n"
+               "compiler: " CC_VERSION ".\n",
                version_single_line(pfx)
        );
        return buf;