This is a standard; was surprised memcached didn't support it already.
It is much quieter than looking for the current version in help output.

Signed-off-by: Dan McGee <[email protected]>
---

All the recent 1.4.XX releases left me wondering what version I had
installed...and then I realized -V wasn't supported. So this is a patch for
1.4, but it isn't exactly a complex addition either.

 memcached.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/memcached.c b/memcached.c
index b121e16..b28ab8b 100644
--- a/memcached.c
+++ b/memcached.c
@@ -4477,6 +4477,7 @@ static void usage(void) {
            "-vvv          extremely verbose (also print internal state 
transitions)\n"
            "-h            print this help and exit\n"
            "-i            print memcached and libevent license\n"
+           "-V            print version and exit\n"
            "-P <file>     save PID in <file>, only used with -d option\n"
            "-f <factor>   chunk size growth factor (default: 1.25)\n"
            "-n <bytes>    minimum space allocated for key+value+flags 
(default: 48)\n");
@@ -4763,7 +4764,7 @@ int main (int argc, char **argv) {
           "M"   /* return error on memory exhausted */
           "c:"  /* max simultaneous connections */
           "k"   /* lock down all paged memory */
-          "hi"  /* help, licence info */
+          "hiV" /* help, licence info, version */
           "r"   /* maximize core file limit */
           "v"   /* verbose */
           "d"   /* daemon mode */
@@ -4815,6 +4816,9 @@ int main (int argc, char **argv) {
         case 'i':
             usage_license();
             exit(EXIT_SUCCESS);
+               case 'V':
+                       printf(PACKAGE " " VERSION "\n");
+            exit(EXIT_SUCCESS);
         case 'k':
             lock_memory = true;
             break;
-- 
1.7.9

Reply via email to