svn rev #22068: trunk/src/clients/klist/

raeburn@MIT.EDU raeburn at MIT.EDU
Fri Mar 6 18:57:10 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22068
Commit By: raeburn
Log Message:
ticket: 4241
target_version: 1.7
tags: pullup

Add "-V" option to klist to print the package name and version, and exit.



Changed Files:
U   trunk/src/clients/klist/klist.c
Modified: trunk/src/clients/klist/klist.c
===================================================================
--- trunk/src/clients/klist/klist.c	2009-03-06 17:26:29 UTC (rev 22067)
+++ trunk/src/clients/klist/klist.c	2009-03-06 23:57:10 UTC (rev 22068)
@@ -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 @@
 {
 #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 @@
 
     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 @@
 	    break;
 	case '5':
 	    break;
+	case 'V':
+	    print_version = 1;
+	    break;
 	default:
 	    usage();
 	    break;
@@ -172,6 +177,11 @@
 	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);




More information about the cvs-krb5 mailing list