From: Tom Yu Date: Tue, 14 Apr 2009 19:53:56 +0000 (+0000) Subject: pull up r22068 from trunk X-Git-Tag: krb5-1.7-beta1~53 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2998a275f16e4b083fd5b8986c7c3da7999c7fbb;p=krb5.git pull up r22068 from trunk ------------------------------------------------------------------------ r22068 | raeburn | 2009-03-06 18:57:10 -0500 (Fri, 06 Mar 2009) | 6 lines Changed paths: M /trunk/src/clients/klist/klist.c ticket: 4241 target_version: 1.7 tags: pullup Add "-V" option to klist to print the package name and version, and exit. ticket: 4241 version_fixed: 1.7 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-7@22214 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/clients/klist/klist.c b/src/clients/klist/klist.c index 70ca604e5..c20aa9801 100644 --- a/src/clients/klist/klist.c +++ b/src/clients/klist/klist.c @@ -56,7 +56,7 @@ extern int optind; int show_flags = 0, show_time = 0, status_only = 0, show_keys = 0; -int show_etype = 0, show_addresses = 0, no_resolve = 0; +int show_etype = 0, show_addresses = 0, no_resolve = 0, print_version = 0; char *defname; char *progname; krb5_int32 now; @@ -81,12 +81,13 @@ static void usage() { #define KRB_AVAIL_STRING(x) ((x)?"available":"not available") - fprintf(stderr, "Usage: %s [-e] [[-c] [-f] [-s] [-a [-n]]] %s", + fprintf(stderr, "Usage: %s [-e] [-V] [[-c] [-f] [-s] [-a [-n]]] %s", progname, "[-k [-t] [-K]] [name]\n"); fprintf(stderr, "\t-c specifies credentials cache\n"); fprintf(stderr, "\t-k specifies keytab\n"); fprintf(stderr, "\t (Default is credentials cache)\n"); fprintf(stderr, "\t-e shows the encryption type\n"); + fprintf(stderr, "\t-V shows the Kerberos version and exits\n"); fprintf(stderr, "\toptions for credential caches:\n"); fprintf(stderr, "\t\t-f shows credentials flags\n"); fprintf(stderr, "\t\t-s sets exit status based on valid tgt existence\n"); @@ -111,7 +112,8 @@ main(argc, argv) name = NULL; mode = DEFAULT; - while ((c = getopt(argc, argv, "fetKsnack45")) != -1) { + /* V=version so v can be used for verbose later if desired. */ + while ((c = getopt(argc, argv, "fetKsnack45V")) != -1) { switch (c) { case 'f': show_flags = 1; @@ -148,6 +150,9 @@ main(argc, argv) break; case '5': break; + case 'V': + print_version = 1; + break; default: usage(); break; @@ -172,6 +177,11 @@ main(argc, argv) usage(); } + if (print_version) { + printf("%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); + exit(0); + } + name = (optind == argc-1) ? argv[optind] : 0; now = time(0);