aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2018-03-27 16:47:57 +0200
committerGitHub <noreply@github.com>2018-03-27 16:47:57 +0200
commitf413bc8e8d415e7107f6b23274d5c0d1a91f012d (patch)
tree0eafb067c294244a200fe679f044d66136f1b4c9
parent9874f6078a5fa8981dba6a96adcffbc7a3ec7e8f (diff)
parent9b27bd8a4e33dfd3994340af7aab334c262ce27e (diff)
downloadPROJ-f413bc8e8d415e7107f6b23274d5c0d1a91f012d.tar.gz
PROJ-f413bc8e8d415e7107f6b23274d5c0d1a91f012d.zip
Merge pull request #907 from kbevers/print-help
Print help
-rw-r--r--docs/source/apps/cct.rst4
-rw-r--r--docs/source/apps/gie.rst4
-rw-r--r--src/cct.c3
-rw-r--r--src/gie.c10
4 files changed, 17 insertions, 4 deletions
diff --git a/docs/source/apps/cct.rst b/docs/source/apps/cct.rst
index 9153e29b..dc2944f2 100644
--- a/docs/source/apps/cct.rst
+++ b/docs/source/apps/cct.rst
@@ -49,6 +49,10 @@ The following control parameters can appear in any order:
Write non-essential, but potentially useful, information to stderr.
Repeat for additional information (``-vv``, ``-vvv``, etc.)
+.. option:: --version
+
+ Print version number.
+
The *+args* arguments are associated with coordinate operation parameters.
Usage varies with operation.
diff --git a/docs/source/apps/gie.rst b/docs/source/apps/gie.rst
index f94c1171..41664660 100644
--- a/docs/source/apps/gie.rst
+++ b/docs/source/apps/gie.rst
@@ -47,6 +47,10 @@ already employed for compiling the library.
List the PROJ internal system error codes
+.. option:: --version
+
+ Print version number
+
Tests for :program:`gie` are defined in simple text files. Usually having the
extension ``.gie``. Test for :program:`gie` are written in the purpose-build command language for gie.
The basic functionality of the gie command language is implemented through just
diff --git a/src/cct.c b/src/cct.c
index 8096986d..6b8f35f3 100644
--- a/src/cct.c
+++ b/src/cct.c
@@ -117,6 +117,7 @@ static const char usage[] = {
" --verbose Alias for -v\n"
" --inverse Alias for -I\n"
" --help Alias for -h\n"
+ " --version Print version number\n"
"--------------------------------------------------------------------------------\n"
"Operator Specs:\n"
"--------------------------------------------------------------------------------\n"
@@ -165,7 +166,7 @@ int main(int argc, char **argv) {
if (0==o)
return 0;
- if (opt_given (o, "h")) {
+ if (opt_given (o, "h") || argc==1) {
printf (usage, o->progname);
return 0;
}
diff --git a/src/gie.c b/src/gie.c
index 14d0fde3..8c735b88 100644
--- a/src/gie.c
+++ b/src/gie.c
@@ -221,6 +221,7 @@ static const char usage[] = {
" --verbose Alias for -v\n"
" --help Alias for -h\n"
" --list Alias for -l\n"
+ " --version Print version number\n"
"--------------------------------------------------------------------------------\n"
"Examples:\n"
"--------------------------------------------------------------------------------\n"
@@ -247,21 +248,24 @@ int main (int argc, char **argv) {
if (0==o)
return 0;
- if (opt_given (o, "h")) {
+ if (opt_given (o, "h") || argc==1) {
printf (usage, o->progname);
+ free (o);
return 0;
}
if (opt_given (o, "version")) {
fprintf (stdout, "%s: %s\n", o->progname, pj_get_release ());
+ free (o);
return 0;
}
- if (opt_given (o, "l"))
+ if (opt_given (o, "l")) {
+ free (o);
return list_err_codes ();
-
+ }
T.verbosity = opt_given (o, "q");
if (T.verbosity)