Debian Codegraph @

utils/xml2pmx/xml2pmx-src/wrapper.c

raw
1 /* wrapper.c -- Copyright (c) 2020 J. M. Spivey */
2 /* and Bob Tennent */
3
4 char xml2pmxVersion[12] = "2021-02-07";
5
6 #ifdef HAVE_CONFIG_H /* for TeXLive */
7 #include <config.h>
8 #endif
9
10 # ifdef KPATHSEA
11 # include <kpathsea/getopt.h>
12 # else
13 # include <getopt.h>
14 # endif
15
16 #include <stdlib.h>
17 #include <stdio.h>
18 #include <string.h>
19
20 # ifdef HAVE_STDBOOL_H
21 # include <stdbool.h>
22 # else
23 # ifndef HAVE__BOOL
24 # define _Bool signed char
25 # endif
26 # define bool _Bool
27 # define true 1
28 # define false 0
29 # endif
30
31
32 static void
33 usage ()
34 {
35 printf ("Usage: xml2pmx [-v | --version | -h | --help]\n");
36 printf (" xml2pmx infile.xml outfile.pmx [p|d|v|s|l] .. \n");
37 }
38
39
40 int xmain(int argc, char **argv);
41
42 int main(int argc, char **argv) {
43 int c;
44 # define NOPTS 3
45 struct option longopts[NOPTS] =
46 { { "help", 0, NULL, 'h'},
47 { "version", 0, NULL, 'v'},
48 { NULL, 0, NULL, 0}
49 };
50
51 printf ("This is xml2pmx, version %s.\n", xml2pmxVersion);
52
53 if (argc < 2) {
54 usage();
55 exit (0);
56 }
57
58 c = getopt_long (argc, argv, "hv", longopts, NULL);
59 while (c != -1)
60 {
61 switch (c)
62 {
63 case 'h':
64 usage ();
65 printf ("Please report bugs to [email protected].\n" );
66 exit (0);
67 case 'v':
68 exit (0);
69 case '?':
70 exit (EXIT_FAILURE);
71 default:
72 printf ("Function getopt returned character code 0%o.\n",
73 (unsigned int) c);
74 exit (EXIT_FAILURE);
75 }
76 c = getopt_long (argc, argv, "hv", longopts, NULL);
77 }
78
79 puts ( "Copyright (C) 2015-21 Dieter Gloetzel, Mike Spivey and Bob Tennent" );
80 puts ( "License GNU GPL version 3 or later <http://gnu.org/licences/gpl.html>." );
81 puts ( "There is NO WARRANTY, to the extent permitted by law." );
82 puts ( "" );
83
84 return xmain(argc, argv);
85 }
86