File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,14 @@ struct datapoint_f {
5353};
5454
5555
56+ /* Print version */
57+ void version () {
58+ cout << PROGNAME << " Version " << VERSION << " , License GPLv3" <<endl;
59+ }
60+
5661/* Print usage info */
5762void usage () {
58- cout << PROGNAME << " Version " << VERSION << " , License GPLv3 " <<endl ;
63+ version () ;
5964 cout << " Convert therion surface meshes to survex" << endl;
6065 cout << " Usage: [-hsdt] [-o outfile] [-i infile] -- [infile]" <<endl;
6166 cout << " -o outfile File to write to. Will be derived from infile if not specified." <<endl;
@@ -81,15 +86,25 @@ int main (int argc, char **argv)
8186 int index;
8287 int c;
8388
89+ // support standard POSIX options
90+ for (int i=0 ; i<argc; i++) {
91+ if (NULL != strstr (argv[i]," --version" )) { version (); return 0 ; }
92+ if (NULL != strstr (argv[i]," --help" )) { usage (); return 0 ; }
93+ }
94+
8495 opterr = 0 ;
8596
86- while ((c = getopt (argc, argv, " hstdi :o:" )) != -1 )
97+ while ((c = getopt (argc, argv, " vhstdi :o:" )) != -1 )
8798 switch (c)
8899 {
89100 case ' h' :
90101 usage ();
91102 return 0 ;
92103 break ;
104+ case ' v' :
105+ version ();
106+ return 0 ;
107+ break ;
93108 case ' i' :
94109 inFile = optarg;
95110 break ;
You can’t perform that action at this time.
0 commit comments