summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-01 23:58:50 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-02 00:00:37 -0700
commit9db7347730f3c8c9d77e5be4c9746f6d614ce470 (patch)
tree9b0e6b2c6da9b6d3a4acd49781ffd2000c4ad3e6
parent30cb700ab15c963a5cbf16cfe6281d5841f59532 (diff)
Add -version option to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--ico.c5
-rw-r--r--man/ico.man3
2 files changed, 8 insertions, 0 deletions
diff --git a/ico.c b/ico.c
index b96188e..8c62f93 100644
--- a/ico.c
+++ b/ico.c
@@ -209,6 +209,7 @@ static const char *help_message =
#ifdef MULTITHREAD
" -threads number number of windows, each its own thread\n"
#endif
+" -version print program version\n"
;
static const char *ProgramName; /* argv[0] */
@@ -1273,6 +1274,10 @@ int main(int argc, const char **argv)
giveObjHelp();
exit(1);
}
+ else if (strcmp(*argv, "-version") == 0) {
+ puts(PACKAGE_STRING);
+ exit(0);
+ }
else { /* unknown arg */
fprintf (stderr, "%s: unrecognized argument %s\n\n",
ProgramName, *argv);
diff --git a/man/ico.man b/man/ico.man
index 34d6254..ed59c4d 100644
--- a/man/ico.man
+++ b/man/ico.man
@@ -54,6 +54,9 @@ about each object.
.B -colors \fIcolor color ...\fP
Specify what colors should be used to draw the filled faces of the object.
If less colors than faces are given, the colors are reused.
+.TP
+.B -version
+Print program version information and exit.
.SH PROGRAM TERMINATION
.LP
Pressing "q" will close a window. If compiled with threads support, the