Skip to content

Commit c4f7fe7

Browse files
committed
make --help output more help2man-friendly
Change-Id: Ibf1c4f868398b8e1c16ba0038f853d510c4dff21
1 parent 4637733 commit c4f7fe7

File tree

6 files changed

+150
-18
lines changed

6 files changed

+150
-18
lines changed

src/conv/raw/vsd2raw.cpp

+27-3
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,48 @@
77
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
88
*/
99

10+
#ifdef HAVE_CONFIG_H
11+
#include "config.h"
12+
#endif
13+
1014
#include <stdio.h>
1115
#include <string.h>
1216
#include <librevenge-stream/librevenge-stream.h>
1317
#include <librevenge-generators/librevenge-generators.h>
1418
#include <librevenge/librevenge.h>
1519
#include <libvisio/libvisio.h>
1620

21+
#ifndef PACKAGE
22+
#define PACKAGE "libvisio"
23+
#endif
24+
#ifndef VERSION
25+
#define VERSION "UNKNOWN VERSION"
26+
#endif
27+
1728
namespace
1829
{
1930

2031
int printUsage()
2132
{
22-
printf("Usage: vsd2raw [OPTION] <Visio Document File>\n");
33+
printf("`vsd2raw' is used to test import of Microsoft Visio documents in " PACKAGE ".\n");
34+
printf("\n");
35+
printf("Usage: vsd2raw [OPTION] INPUT\n");
2336
printf("\n");
2437
printf("Options:\n");
25-
printf("--callgraph Display the call graph nesting level\n");
26-
printf("--help Shows this help message\n");
38+
printf("\t--callgraph display the call graph nesting level\n");
39+
printf("\t--help show this help message\n");
40+
printf("\t--version show version information\n");
41+
printf("\n");
42+
printf("Report bugs to <https://bugs.documentfoundation.org/>.\n");
2743
return -1;
2844
}
2945

46+
int printVersion()
47+
{
48+
printf("vsd2raw " VERSION "\n");
49+
return 0;
50+
}
51+
3052
} // anonymous namespace
3153

3254
int main(int argc, char *argv[])
@@ -41,6 +63,8 @@ int main(int argc, char *argv[])
4163
{
4264
if (!strcmp(argv[i], "--callgraph"))
4365
printIndentLevel = true;
66+
else if (!strcmp(argv[i], "--version"))
67+
return printVersion();
4468
else if (!file && strncmp(argv[i], "--", 2))
4569
file = argv[i];
4670
else

src/conv/raw/vss2raw.cpp

+27-3
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,48 @@
77
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
88
*/
99

10+
#ifdef HAVE_CONFIG_H
11+
#include "config.h"
12+
#endif
13+
1014
#include <stdio.h>
1115
#include <string.h>
1216
#include <librevenge-stream/librevenge-stream.h>
1317
#include <librevenge-generators/librevenge-generators.h>
1418
#include <librevenge/librevenge.h>
1519
#include <libvisio/libvisio.h>
1620

21+
#ifndef PACKAGE
22+
#define PACKAGE "libvisio"
23+
#endif
24+
#ifndef VERSION
25+
#define VERSION "UNKNOWN VERSION"
26+
#endif
27+
1728
namespace
1829
{
1930

2031
int printUsage()
2132
{
22-
printf("Usage: vsd2raw [OPTION] <Visio Stencils File>\n");
33+
printf("`vss2raw' is used to test import of Microsoft Visio stencils in " PACKAGE ".\n");
34+
printf("\n");
35+
printf("Usage: vss2raw [OPTION] INPUT\n");
2336
printf("\n");
2437
printf("Options:\n");
25-
printf("--callgraph Display the call graph nesting level\n");
26-
printf("--help Shows this help message\n");
38+
printf("\t--callgraph display the call graph nesting level\n");
39+
printf("\t--help show this help message\n");
40+
printf("\t--version show version information\n");
41+
printf("\n");
42+
printf("Report bugs to <https://bugs.documentfoundation.org/>.\n");
2743
return -1;
2844
}
2945

46+
int printVersion()
47+
{
48+
printf("vss2raw " VERSION "\n");
49+
return 0;
50+
}
51+
3052
} // anonymous namespace
3153

3254
int main(int argc, char *argv[])
@@ -41,6 +63,8 @@ int main(int argc, char *argv[])
4163
{
4264
if (!strcmp(argv[i], "--callgraph"))
4365
printIndentLevel = true;
66+
else if (!strcmp(argv[i], "--version"))
67+
return printVersion();
4468
else if (!file && strncmp(argv[i], "--", 2))
4569
file = argv[i];
4670
else

src/conv/svg/vsd2xhtml.cpp

+24-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
88
*/
99

10+
#ifdef HAVE_CONFIG_H
11+
#include "config.h"
12+
#endif
13+
1014
#include <iostream>
1115
#include <sstream>
1216
#include <stdio.h>
@@ -16,18 +20,33 @@
1620
#include <librevenge/librevenge.h>
1721
#include <libvisio/libvisio.h>
1822

23+
#ifndef VERSION
24+
#define VERSION "UNKNOWN VERSION"
25+
#endif
26+
1927
namespace
2028
{
2129

2230
int printUsage()
2331
{
24-
printf("Usage: vsd2xhtml [OPTION] <Visio Document>\n");
32+
printf("`vsd2xhtml' converts Microsoft Visio documents to SVG.\n");
33+
printf("\n");
34+
printf("Usage: vsd2xhtml [OPTION] INPUT\n");
2535
printf("\n");
2636
printf("Options:\n");
27-
printf("--help Shows this help message\n");
37+
printf("\t--help show this help message\n");
38+
printf("\t--version show version information\n");
39+
printf("\n");
40+
printf("Report bugs to <https://bugs.documentfoundation.org/>.\n");
2841
return -1;
2942
}
3043

44+
int printVersion()
45+
{
46+
printf("vsd2xhtml " VERSION "\n");
47+
return 0;
48+
}
49+
3150
} // anonymous namespace
3251

3352
int main(int argc, char *argv[])
@@ -39,7 +58,9 @@ int main(int argc, char *argv[])
3958

4059
for (int i = 1; i < argc; i++)
4160
{
42-
if (!file && strncmp(argv[i], "--", 2))
61+
if (!strcmp(argv[i], "--version"))
62+
return printVersion();
63+
else if (!file && strncmp(argv[i], "--", 2))
4364
file = argv[i];
4465
else
4566
return printUsage();

src/conv/svg/vss2xhtml.cpp

+24-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
88
*/
99

10+
#ifdef HAVE_CONFIG_H
11+
#include "config.h"
12+
#endif
13+
1014
#include <iostream>
1115
#include <sstream>
1216
#include <stdio.h>
@@ -16,18 +20,33 @@
1620
#include <librevenge/librevenge.h>
1721
#include <libvisio/libvisio.h>
1822

23+
#ifndef VERSION
24+
#define VERSION "UNKNOWN VERSION"
25+
#endif
26+
1927
namespace
2028
{
2129

2230
int printUsage()
2331
{
24-
printf("Usage: vss2xhtml [OPTION] <Visio Stencils File>\n");
32+
printf("`vss2xhtml' converts Microsoft Visio stencils to SVG.\n");
33+
printf("\n");
34+
printf("Usage: vss2xhtml [OPTION] INPUT\n");
2535
printf("\n");
2636
printf("Options:\n");
27-
printf("--help Shows this help message\n");
37+
printf("\t--help show this help message\n");
38+
printf("\t--version show version information\n");
39+
printf("\n");
40+
printf("Report bugs to <https://bugs.documentfoundation.org/>.\n");
2841
return -1;
2942
}
3043

44+
int printVersion()
45+
{
46+
printf("vss2xhtml " VERSION "\n");
47+
return 0;
48+
}
49+
3150
} // anonymous namespace
3251

3352
int main(int argc, char *argv[])
@@ -39,7 +58,9 @@ int main(int argc, char *argv[])
3958

4059
for (int i = 1; i < argc; i++)
4160
{
42-
if (!file && strncmp(argv[i], "--", 2))
61+
if (!strcmp(argv[i], "--version"))
62+
return printVersion();
63+
else if (!file && strncmp(argv[i], "--", 2))
4364
file = argv[i];
4465
else
4566
return printUsage();

src/conv/text/vsd2text.cpp

+24-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
88
*/
99

10+
#ifdef HAVE_CONFIG_H
11+
#include "config.h"
12+
#endif
13+
1014
#include <stdio.h>
1115
#include <string.h>
1216

@@ -15,18 +19,33 @@
1519
#include <librevenge/librevenge.h>
1620
#include <libvisio/libvisio.h>
1721

22+
#ifndef VERSION
23+
#define VERSION "UNKNOWN VERSION"
24+
#endif
25+
1826
namespace
1927
{
2028

2129
int printUsage()
2230
{
23-
printf("Usage: vsd2text [OPTION] <Visio Document File>\n");
31+
printf("`vsd2text' converts Microsoft Visio documents to plain text.\n");
32+
printf("\n");
33+
printf("Usage: vsd2text [OPTION] INPUT\n");
2434
printf("\n");
2535
printf("Options:\n");
26-
printf("--help Shows this help message\n");
36+
printf("\t--help show this help message\n");
37+
printf("\t--version show version information\n");
38+
printf("\n");
39+
printf("Report bugs to <https://bugs.documentfoundation.org/>.\n");
2740
return -1;
2841
}
2942

43+
int printVersion()
44+
{
45+
printf("vsd2text " VERSION "\n");
46+
return 0;
47+
}
48+
3049
} // anonymous namespace
3150

3251
int main(int argc, char *argv[])
@@ -38,7 +57,9 @@ int main(int argc, char *argv[])
3857

3958
for (int i = 1; i < argc; i++)
4059
{
41-
if (!file && strncmp(argv[i], "--", 2))
60+
if (!strcmp(argv[i], "--version"))
61+
return printVersion();
62+
else if (!file && strncmp(argv[i], "--", 2))
4263
file = argv[i];
4364
else
4465
return printUsage();

src/conv/text/vss2text.cpp

+24-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
88
*/
99

10+
#ifdef HAVE_CONFIG_H
11+
#include "config.h"
12+
#endif
13+
1014
#include <stdio.h>
1115
#include <string.h>
1216

@@ -15,18 +19,33 @@
1519
#include <librevenge/librevenge.h>
1620
#include <libvisio/libvisio.h>
1721

22+
#ifndef VERSION
23+
#define VERSION "UNKNOWN VERSION"
24+
#endif
25+
1826
namespace
1927
{
2028

2129
int printUsage()
2230
{
23-
printf("Usage: vss2text [OPTION] <Visio Stencils File>\n");
31+
printf("`vss2text' converts Microsoft Visio stencils to plain text.\n");
32+
printf("\n");
33+
printf("Usage: vss2text [OPTION] INPUT\n");
2434
printf("\n");
2535
printf("Options:\n");
26-
printf("--help Shows this help message\n");
36+
printf("\t--help show this help message\n");
37+
printf("\t--version show version information\n");
38+
printf("\n");
39+
printf("Report bugs to <https://bugs.documentfoundation.org/>.\n");
2740
return -1;
2841
}
2942

43+
int printVersion()
44+
{
45+
printf("vss2text " VERSION "\n");
46+
return 0;
47+
}
48+
3049
} // anonymous namespace
3150

3251
int main(int argc, char *argv[])
@@ -38,7 +57,9 @@ int main(int argc, char *argv[])
3857

3958
for (int i = 1; i < argc; i++)
4059
{
41-
if (!file && strncmp(argv[i], "--", 2))
60+
if (!strcmp(argv[i], "--version"))
61+
return printVersion();
62+
else if (!file && strncmp(argv[i], "--", 2))
4263
file = argv[i];
4364
else
4465
return printUsage();

0 commit comments

Comments
 (0)