use getarg

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5823 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1999-04-01 15:03:57 +00:00
parent 788b4f78f2
commit 433dca9ff4
6 changed files with 122 additions and 22 deletions

View File

@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*/
#include "kadm5_locl.h"
#include "iprop.h"
RCSID("$Id$");
@@ -64,6 +64,14 @@ apply_entry(u_int32_t ver,
printf ("done\n");
}
int version_flag;
int help_flag;
struct getargs args[] = {
{ "version", 0, arg_flag, &version_flag },
{ "help", 0, arg_flag, &help_flag }
};
int num_args = sizeof(args) / sizeof(args[0]);
int
main(int argc, char **argv)
{
@@ -71,9 +79,16 @@ main(int argc, char **argv)
void *kadm_handle;
kadm5_config_params conf;
set_progname(argv[0]);
krb5_init_context(&context);
int optind;
optind = krb5_program_setup(&context, argc, argv, args, num_args, NULL);
if(help_flag)
krb5_std_usage(0, args, num_args);
if(version_flag) {
print_version(NULL);
exit(0);
}
memset(&conf, 0, sizeof(conf));
ret = kadm5_init_with_password_ctx (context,