add option parsing

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9044 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
2000-09-10 19:19:20 +00:00
parent 47b95f3233
commit 9c1353f1f8
4 changed files with 117 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999 - 2000 Kungliga Tekniska H<>gskolan
* Copyright (c) 1999-2000 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -35,19 +35,29 @@
RCSID("$Id$");
static void
usage(void)
{
fprintf (stderr, "Usage: del_enctype principal enctypes...\n");
}
/*
* del_enctype principal enctypes...
*/
static struct getargs args[] = {
{ "help", 'h', arg_flag, NULL }
};
static int num_args = sizeof(args) / sizeof(args[0]);
static void
usage(void)
{
arg_printusage (args, num_args, "del_enctype", "principal enctypes...");
}
int
del_enctype(int argc, char **argv)
{
int optind = 0;
int help_flag = 0;
kadm5_principal_ent_rec princ;
krb5_principal princ_ent = NULL;
krb5_error_code ret;
@@ -57,7 +67,13 @@ del_enctype(int argc, char **argv)
int n_etypes;
krb5_enctype *etypes;
if (argc < 3) {
args[0].value = &help_flag;
if(getarg(args, num_args, argc, argv, &optind)) {
usage ();
return 0;
}
if(argc - optind < 3 || help_flag) {
usage ();
return 0;
}