aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2018-02-06 09:17:21 +0100
committerGitHub <noreply@github.com>2018-02-06 09:17:21 +0100
commitcdce49332f5d66cb9ab6b9a922cb65f566f9a9ed (patch)
treef4db3efbb8fd787b0603cb44661f3e4b1c63c9f3 /src
parentb24fc0f7cf105d89c194b63dc6d0dd2cf911b9c1 (diff)
parent0ca9e9ff582e9ed2243c1991326b172880d94f35 (diff)
downloadPROJ-cdce49332f5d66cb9ab6b9a922cb65f566f9a9ed.tar.gz
PROJ-cdce49332f5d66cb9ab6b9a922cb65f566f9a9ed.zip
Merge pull request #771 from busstoptaktik/gie_cct_version
Add --version option to gie and cct.
Diffstat (limited to 'src')
-rw-r--r--src/cct.c7
-rw-r--r--src/gie.c12
-rw-r--r--src/optargpm.h2
3 files changed, 15 insertions, 6 deletions
diff --git a/src/cct.c b/src/cct.c
index 7e48311a..2ce478bd 100644
--- a/src/cct.c
+++ b/src/cct.c
@@ -157,7 +157,7 @@ int main(int argc, char **argv) {
int nfields = 4, direction = 1, verbose;
double fixed_z = HUGE_VAL, fixed_time = HUGE_VAL;
int columns_xyzt[] = {1, 2, 3, 4};
- const char *longflags[] = {"v=verbose", "h=help", "I=inverse", 0};
+ const char *longflags[] = {"v=verbose", "h=help", "I=inverse", "version", 0};
const char *longkeys[] = {"o=output", "c=columns", "z=height", "t=time", 0};
o = opt_parse (argc, argv, "hvI", "cozt", longflags, longkeys);
@@ -173,6 +173,11 @@ int main(int argc, char **argv) {
direction = opt_given (o, "I")? -1: 1;
verbose = opt_given (o, "v");
+ if (opt_given (o, "version")) {
+ fprintf (stdout, "%s: %s\n", o->progname, pj_get_release ());
+ return 0;
+ }
+
if (opt_given (o, "o"))
fout = fopen (opt_arg (o, "output"), "wt");
if (0==fout) {
diff --git a/src/gie.c b/src/gie.c
index b2673d13..ee5bae44 100644
--- a/src/gie.c
+++ b/src/gie.c
@@ -133,8 +133,6 @@ typedef struct ffio {
size_t level;
} ffio;
-FILE *test = 0;
-
static int get_inp (ffio *F);
static int skip_to_next_tag (ffio *F);
static int step_into_gie_block (ffio *F);
@@ -231,7 +229,7 @@ static const char usage[] = {
int main (int argc, char **argv) {
int i;
- const char *longflags[] = {"v=verbose", "q=quiet", "h=help", "l=list", 0};
+ const char *longflags[] = {"v=verbose", "q=quiet", "h=help", "l=list", "version", 0};
const char *longkeys[] = {"o=output", 0};
OPTARGS *o;
@@ -240,7 +238,6 @@ int main (int argc, char **argv) {
T.verbosity = 1;
T.tolerance = 5e-4;
- test = fopen ("test.c", "wt");
o = opt_parse (argc, argv, "hlvq", "o", longflags, longkeys);
if (0==o)
return 0;
@@ -250,6 +247,13 @@ int main (int argc, char **argv) {
return 0;
}
+
+ if (opt_given (o, "version")) {
+ fprintf (stdout, "%s: %s\n", o->progname, pj_get_release ());
+ return 0;
+ }
+
+
if (opt_given (o, "l"))
return list_err_codes ();
diff --git a/src/optargpm.h b/src/optargpm.h
index d464b5a9..8a9dd0c7 100644
--- a/src/optargpm.h
+++ b/src/optargpm.h
@@ -84,7 +84,7 @@ opt_eof_handler (o):
Usage is probably easiest understood by a brief textbook style example:
-Consider a simple program taking the conventinal "-v, -h, -o" options
+Consider a simple program taking the conventional "-v, -h, -o" options
indicating "verbose output", "help please", and "output file specification",
respectively.