From: Constantin Kaplinsky Date: Wed, 4 Jun 2008 10:43:10 +0000 (+0000) Subject: Implemented support for command-line options that print version information X-Git-Tag: v0.0.90~450 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2039d7b4284c3327cfe5c23d2d2301c6c5865215;p=tigervnc.git Implemented support for command-line options that print version information on stdout: -version, --version and -v are all equivalent. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2578 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx index 637af28c..baf9fcce 100644 --- a/unix/x0vncserver/x0vncserver.cxx +++ b/unix/x0vncserver/x0vncserver.cxx @@ -368,11 +368,17 @@ private: char* programName; -static void usage() +static void printVersion(FILE *fp) { - fprintf(stderr, "TightVNC Server version %s, built %s\n\n", + fprintf(fp, "TightVNC Server version %s, built %s\n", VERSION, buildtime); - fprintf(stderr, "Usage: %s []\n", programName); +} + +static void usage() +{ + printVersion(stderr); + fprintf(stderr, "\nUsage: %s []\n", programName); + fprintf(stderr, " %s --version\n", programName); fprintf(stderr,"\n" "Parameters can be turned on with - or off with -=0\n" "Parameters which take a value can be specified as " @@ -403,6 +409,12 @@ int main(int argc, char** argv) continue; } } + if (strcmp(argv[i], "-v") == 0 || + strcmp(argv[i], "-version") == 0 || + strcmp(argv[i], "--version") == 0) { + printVersion(stdout); + return 0; + } usage(); } diff --git a/unix/x0vncserver/x0vncserver.man b/unix/x0vncserver/x0vncserver.man index 850f1d7b..667661a3 100644 --- a/unix/x0vncserver/x0vncserver.man +++ b/unix/x0vncserver/x0vncserver.man @@ -1,9 +1,11 @@ -.TH X0VNCSERVER 1 "May 30, 2008" "TightVNC" "TightVNC Manual" +.TH X0VNCSERVER 1 "Jun 04, 2008" "TightVNC" "TightVNC Manual" .SH NAME x0vncserver \- TightVNC Server for real X displays .SH SYNOPSIS .B x0vncserver .RI [ options ] +.br +.B x0vncserver -version .SH DESCRIPTION .B x0vncserver is a TightVNC Server which makes any X display remotely accessible via VNC,