From 7ff74266fac998b0dbbf0aa5d6a3018c8a948ee4 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Sun, 21 Feb 2016 07:52:32 +0100 Subject: make --help output more help2man-friendly --- src/conv/html/sw6022html.cpp | 22 +++++++++++++++------- src/conv/raw/sw6022raw.cpp | 27 +++++++++++++++++++-------- src/conv/text/sw6022text.cpp | 24 ++++++++++++++++-------- 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/src/conv/html/sw6022html.cpp b/src/conv/html/sw6022html.cpp index 2e3202c..e1d9312 100644 --- a/src/conv/html/sw6022html.cpp +++ b/src/conv/html/sw6022html.cpp @@ -23,22 +23,30 @@ #define VERSION "UNKNOWN VERSION" #endif +#define TOOL "sw6022html" + namespace { int printUsage() { - printf("Usage: sw6022html [OPTION] \n"); - printf("\n"); - printf("Options:\n"); - printf("--help Shows this help message\n"); - printf("--version Output sw6022html version\n"); - return -1; + printf( + "`" TOOL "' converts Software602 documents to HTML.\n" + "\n" + "Usage: " TOOL " [OPTION] INPUT\n" + "\n" + "Options:\n" + "\t--help show this help message\n" + "\t--version show version information\n" + "\n" + "Report bugs to <>.\n" + ); + return 0; } int printVersion() { - printf("sw6022html %s\n", VERSION); + printf(TOOL " " VERSION "\n"); return 0; } diff --git a/src/conv/raw/sw6022raw.cpp b/src/conv/raw/sw6022raw.cpp index 092e56b..9498e16 100644 --- a/src/conv/raw/sw6022raw.cpp +++ b/src/conv/raw/sw6022raw.cpp @@ -19,27 +19,38 @@ #include "config.h" #endif +#ifndef PACKAGE +#define PACKAGE "libsw602" +#endif #ifndef VERSION #define VERSION "UNKNOWN VERSION" #endif +#define TOOL "sw6022raw" + namespace { int printUsage() { - printf("Usage: sw6022raw [OPTION] \n"); - printf("\n"); - printf("Options:\n"); - printf("--callgraph Display the call graph nesting level\n"); - printf("--help Shows this help message\n"); - printf("--version Output sw6022raw version \n"); - return -1; + printf( + "`" TOOL "' is used to test " PACKAGE ".\n" + "\n" + "Usage: " TOOL " [OPTION] INPUT\n" + "\n" + "Options:\n" + "\t--callgraph display the call graph nesting level\n" + "\t--help show this help message\n" + "\t--version show version information\n" + "\n" + "Report bugs to <>.\n" + ); + return 0; } int printVersion() { - printf("sw6022raw %s\n", VERSION); + printf(TOOL " " VERSION "\n"); return 0; } diff --git a/src/conv/text/sw6022text.cpp b/src/conv/text/sw6022text.cpp index abbd22a..e661be5 100644 --- a/src/conv/text/sw6022text.cpp +++ b/src/conv/text/sw6022text.cpp @@ -23,23 +23,31 @@ #define VERSION "UNKNOWN VERSION" #endif +#define TOOL "sw6022text" + namespace { int printUsage() { - printf("Usage: sw6022text [OPTION] \n"); - printf("\n"); - printf("Options:\n"); - printf("--info Display document metadata instead of the text\n"); - printf("--help Shows this help message\n"); - printf("--version Output sw6022text version\n"); - return -1; + printf( + "`" TOOL "' converts Software602 documents to plain text.\n" + "\n" + "Usage: " TOOL " [OPTION] INPUT\n" + "\n" + "Options:\n" + "\t--info print document metadata instead of text\n" + "\t--help show this help message\n" + "\t--version show version information\n" + "\n" + "Report bugs to <>.\n" + ); + return 0; } int printVersion() { - printf("sw6022text %s\n", VERSION); + printf(TOOL " " VERSION "\n"); return 0; } -- cgit v1.2.3