diff options
Diffstat (limited to 'src/clients/klist/klist.c')
-rw-r--r-- | src/clients/klist/klist.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/clients/klist/klist.c b/src/clients/klist/klist.c new file mode 100644 index 0000000000..0e96b3554a --- /dev/null +++ b/src/clients/klist/klist.c @@ -0,0 +1,70 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * <krb5/mit-copyright.h>. + * + * List out the contents of your credential cache. + */ + +#if !defined(lint) && !defined(SABER) +static char rcsid_klist_c [] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include <stdio.h> + +#include <krb5/copyright.h> +#include <krb5/krb5.h> + +extern int optind; +extern char *optarg; + +main(argc, argv) + int argc; + char **argv; +{ + int c; + int i; + int errflg = 0; + int code; + krb5_ccache cache = NULL; + krb5_cc_cursor cur; + char *cache_name; + + initialize_krb5_error_table(); + + while ((c = getopt(argc, argv, "c:")) != EOF) { + switch (c) { + case 'c': + if (cache == NULL) { + cache_name = optarg; + + code = krb5_cc_resolve (cache_name, &cache); + if (code != 0) { + com_err(argv[0], code, "while resolving %s", cache_name); + errflg++; + } + } else { + fprintf(stderr, "Only one -c option allowed\n"); + errflg++; + } + break; + case '?': + default: + errflg++; + break; + } + } + + if (optind != argc) + errflg++; + + if (errflg) { + fprintf(stderr, "Usage: %s [ -c cache ]\n", argv[0]); + exit(2); + } +} |