summaryrefslogtreecommitdiffstats
path: root/src/clients/klist
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2009-03-06 23:57:10 +0000
committerKen Raeburn <raeburn@mit.edu>2009-03-06 23:57:10 +0000
commit84bb5a92c1bc9509e978be51243165866b84e1b8 (patch)
treed16e7ed67128d140947bec25b7582760d5f3e9ff /src/clients/klist
parentca9c1212fcb150c3514f8a9ef2f25709b5146de4 (diff)
downloadkrb5-84bb5a92c1bc9509e978be51243165866b84e1b8.tar.gz
krb5-84bb5a92c1bc9509e978be51243165866b84e1b8.tar.xz
krb5-84bb5a92c1bc9509e978be51243165866b84e1b8.zip
Add "-V" option to klist to print the package name and version, and exit
ticket: 4241 target_version: 1.7 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22068 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/clients/klist')
-rw-r--r--src/clients/klist/klist.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/clients/klist/klist.c b/src/clients/klist/klist.c
index 70ca604e51..c20aa9801e 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);