add --help/--verify

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10547 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-08-24 00:59:25 +00:00
parent e322b65755
commit b3880607d5

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997 - 2000 Kungliga Tekniska H<>gskolan
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -35,6 +35,24 @@
RCSID("$Id$");
static int help_flag = 0;
static int version_flag = 0;
static struct getargs args[] = {
{ "version", 0, arg_flag, &version_flag },
{ "help", 0, arg_flag, &help_flag }
};
static void
usage (int ret)
{
arg_printusage (args,
sizeof(args)/sizeof(*args),
NULL,
"[principal]");
exit (ret);
}
int
main(int argc, char **argv)
{
@@ -45,6 +63,19 @@ main(int argc, char **argv)
krb5_get_init_creds_opt get_options;
krb5_verify_init_creds_opt verify_options;
setprogname (argv[0]);
if(getarg(args, sizeof(args) / sizeof(args[0]), argc, argv, &optind))
usage(1);
if (help_flag)
usage (0);
if(version_flag) {
print_version(NULL);
exit(0);
}
ret = krb5_init_context(&context);
if (ret)
errx (1, "krb5_init_context failed: %d", ret);