summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2015-12-27 12:05:45 +0100
committerDavid Tardon <dtardon@redhat.com>2015-12-27 12:05:45 +0100
commit81cc3a8670befdaa1bee74e03eee02246d2834e1 (patch)
treed6519e1536ae42b1cc35cd1dbb3e688d12783f74
parent22b405018fa4d883babb6e510b8dd58ddb55650d (diff)
make --help output more help2man-friendly
Change-Id: I02018a91a2e8fb46edf51f716cebfbe6d07ffe76
-rw-r--r--src/conv/raw/fh2raw.cpp30
-rw-r--r--src/conv/svg/fh2svg.cpp27
-rw-r--r--src/conv/text/fh2text.cpp27
3 files changed, 75 insertions, 9 deletions
diff --git a/src/conv/raw/fh2raw.cpp b/src/conv/raw/fh2raw.cpp
index 808c78d..86f7c37 100644
--- a/src/conv/raw/fh2raw.cpp
+++ b/src/conv/raw/fh2raw.cpp
@@ -7,6 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <string.h>
@@ -15,19 +19,37 @@
#include <librevenge/librevenge.h>
#include <libfreehand/libfreehand.h>
+#ifndef PACKAGE
+#define PACKAGE "libfreehand"
+#endif
+#ifndef VERSION
+#define VERSION "UNKNOWN VERSION"
+#endif
+
namespace
{
int printUsage()
{
- printf("Usage: fh2raw [OPTION] <FreeHand Document>\n");
+ printf("`fh2raw' is used to test " PACKAGE ".\n");
+ printf("\n");
+ printf("Usage: fh2raw [OPTION] INPUT\n");
printf("\n");
printf("Options:\n");
- printf("--callgraph Display the call graph nesting level\n");
- printf("--help Shows this help message\n");
+ printf("\t--callgraph display the call graph nesting level\n");
+ printf("\t--help show this help message\n");
+ printf("\t--version show version information\n");
+ printf("\n");
+ printf("Report bugs to <https://bugs.documentfoundation.org/>.\n");
return -1;
}
+int printVersion()
+{
+ printf("fh2raw " VERSION "\n");
+ return 0;
+}
+
} // anonymous namespace
int main(int argc, char *argv[])
@@ -42,6 +64,8 @@ int main(int argc, char *argv[])
{
if (!strcmp(argv[i], "--callgraph"))
printIndentLevel = true;
+ else if (!strcmp(argv[i], "--version"))
+ return printVersion();
else if (!file && strncmp(argv[i], "--", 2))
file = argv[i];
else
diff --git a/src/conv/svg/fh2svg.cpp b/src/conv/svg/fh2svg.cpp
index 73cbbf2..64a4286 100644
--- a/src/conv/svg/fh2svg.cpp
+++ b/src/conv/svg/fh2svg.cpp
@@ -7,6 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <iostream>
#include <sstream>
#include <stdio.h>
@@ -15,18 +19,33 @@
#include <librevenge/librevenge.h>
#include <libfreehand/libfreehand.h>
+#ifndef VERSION
+#define VERSION "UNKNOWN VERSION"
+#endif
+
namespace
{
int printUsage()
{
- printf("Usage: fh2svg [OPTION] <FreeHand Document>\n");
+ printf("`fh2svg' converts FreeHand drawings to SVG.\n");
+ printf("\n");
+ printf("Usage: fh2svg [OPTION] INPUT\n");
printf("\n");
printf("Options:\n");
- printf("--help Shows this help message\n");
+ printf("\t--help show this help message\n");
+ printf("\t--version show version information\n");
+ printf("\n");
+ printf("Report bugs to <https://bugs.documentfoundation.org/>.\n");
return -1;
}
+int printVersion()
+{
+ printf("fh2svg " VERSION "\n");
+ return 0;
+}
+
} // anonymous namespace
int main(int argc, char *argv[])
@@ -38,7 +57,9 @@ int main(int argc, char *argv[])
for (int i = 1; i < argc; i++)
{
- if (!file && strncmp(argv[i], "--", 2))
+ if (!strcmp(argv[i], "--version"))
+ return printVersion();
+ else if (!file && strncmp(argv[i], "--", 2))
file = argv[i];
else
return printUsage();
diff --git a/src/conv/text/fh2text.cpp b/src/conv/text/fh2text.cpp
index d1cbac5..2cebf10 100644
--- a/src/conv/text/fh2text.cpp
+++ b/src/conv/text/fh2text.cpp
@@ -7,6 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <string.h>
@@ -15,18 +19,33 @@
#include <librevenge/librevenge.h>
#include <libfreehand/libfreehand.h>
+#ifndef VERSION
+#define VERSION "UNKNOWN VERSION"
+#endif
+
namespace
{
int printUsage()
{
- printf("Usage: fh2text [OPTION] <FreeHand Document>\n");
+ printf("`fh2text' converts FreeHand drawings to plain text.\n");
+ printf("\n");
+ printf("Usage: fh2text [OPTION] INPUT\n");
printf("\n");
printf("Options:\n");
- printf("--help Shows this help message\n");
+ printf("\t--help show this help message\n");
+ printf("\t--version show version information\n");
+ printf("\n");
+ printf("Report bugs to <https://bugs.documentfoundation.org/>.\n");
return -1;
}
+int printVersion()
+{
+ printf("fh2text " VERSION "\n");
+ return 0;
+}
+
} // anonymous namespace
int main(int argc, char *argv[])
@@ -38,7 +57,9 @@ int main(int argc, char *argv[])
for (int i = 1; i < argc; i++)
{
- if (!file && strncmp(argv[i], "--", 2))
+ if (!strcmp(argv[i], "--version"))
+ return printVersion();
+ else if (!file && strncmp(argv[i], "--", 2))
file = argv[i];
else
return printUsage();