use getarg
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5823 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -535,15 +535,31 @@ sigterm(int sig)
|
|||||||
exit_flag = 1;
|
exit_flag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
kadm5_config_params conf;
|
kadm5_config_params conf;
|
||||||
|
|
||||||
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);
|
||||||
|
}
|
||||||
|
|
||||||
set_progname (argv[0]);
|
|
||||||
krb5_openlog (context, "kpasswdd", &log_facility);
|
krb5_openlog (context, "kpasswdd", &log_facility);
|
||||||
krb5_set_warn_dest(context, log_facility);
|
krb5_set_warn_dest(context, log_facility);
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "kadm5_locl.h"
|
#include "iprop.h"
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
@@ -67,6 +67,14 @@ print_entry(u_int32_t ver,
|
|||||||
sp->seek (sp, len, SEEK_CUR);
|
sp->seek (sp, len, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -76,9 +84,16 @@ main(int argc, char **argv)
|
|||||||
kadm5_server_context *server_context;
|
kadm5_server_context *server_context;
|
||||||
kadm5_config_params conf;
|
kadm5_config_params conf;
|
||||||
|
|
||||||
set_progname(argv[0]);
|
int optind;
|
||||||
|
|
||||||
krb5_init_context(&context);
|
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));
|
memset(&conf, 0, sizeof(conf));
|
||||||
ret = kadm5_init_with_password_ctx (context,
|
ret = kadm5_init_with_password_ctx (context,
|
||||||
|
@@ -296,6 +296,14 @@ process_msg (krb5_context context, slave *s, int log_fd,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -309,9 +317,16 @@ main(int argc, char **argv)
|
|||||||
slave *slaves = NULL;
|
slave *slaves = NULL;
|
||||||
u_int32_t current_version, old_version = 0;
|
u_int32_t current_version, old_version = 0;
|
||||||
|
|
||||||
set_progname(argv[0]);
|
int optind;
|
||||||
|
|
||||||
krb5_init_context(&context);
|
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));
|
memset(&conf, 0, sizeof(conf));
|
||||||
ret = kadm5_init_with_password_ctx (context,
|
ret = kadm5_init_with_password_ctx (context,
|
||||||
|
@@ -208,6 +208,14 @@ receive (krb5_context context,
|
|||||||
krb5_err (context, 1, ret, "db->close");
|
krb5_err (context, 1, ret, "db->close");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -221,9 +229,16 @@ main(int argc, char **argv)
|
|||||||
krb5_ccache ccache;
|
krb5_ccache ccache;
|
||||||
krb5_principal server;
|
krb5_principal server;
|
||||||
|
|
||||||
set_progname(argv[0]);
|
int optind;
|
||||||
|
|
||||||
krb5_init_context(&context);
|
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));
|
memset(&conf, 0, sizeof(conf));
|
||||||
ret = kadm5_init_with_password_ctx (context,
|
ret = kadm5_init_with_password_ctx (context,
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "kadm5_locl.h"
|
#include "iprop.h"
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
@@ -64,6 +64,14 @@ apply_entry(u_int32_t ver,
|
|||||||
printf ("done\n");
|
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
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -71,9 +79,16 @@ main(int argc, char **argv)
|
|||||||
void *kadm_handle;
|
void *kadm_handle;
|
||||||
kadm5_config_params conf;
|
kadm5_config_params conf;
|
||||||
|
|
||||||
set_progname(argv[0]);
|
int optind;
|
||||||
|
|
||||||
krb5_init_context(&context);
|
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));
|
memset(&conf, 0, sizeof(conf));
|
||||||
ret = kadm5_init_with_password_ctx (context,
|
ret = kadm5_init_with_password_ctx (context,
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998 Kungliga Tekniska H<>gskolan
|
* Copyright (c) 1998-1999 Kungliga Tekniska H<>gskolan
|
||||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "make_cmds.h"
|
#include "make_cmds.h"
|
||||||
|
#include <getarg.h>
|
||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
@@ -197,16 +198,39 @@ generate_commands(void)
|
|||||||
free(cfn);
|
free(cfn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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]);
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage(int code)
|
||||||
|
{
|
||||||
|
arg_printusage(args, num_args, NULL, "command-table");
|
||||||
|
exit(code);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
set_progname(argv[0]);
|
int optind = 0;
|
||||||
|
|
||||||
if(argc != 2) {
|
set_progname(argv[0]);
|
||||||
fprintf(stderr, "Usage: %s command_table\n", __progname);
|
if(getarg(args, num_args, argc, argv, &optind))
|
||||||
exit(1);
|
usage(1);
|
||||||
|
if(help_flag)
|
||||||
|
usage(0);
|
||||||
|
if(version_flag) {
|
||||||
|
print_version(NULL);
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
filename = argv[1];
|
|
||||||
|
if(argc == optind)
|
||||||
|
usage(1);
|
||||||
|
filename = argv[optind];
|
||||||
yyin = fopen(filename, "r");
|
yyin = fopen(filename, "r");
|
||||||
if(yyin == NULL)
|
if(yyin == NULL)
|
||||||
err(1, "%s", filename);
|
err(1, "%s", filename);
|
||||||
|
Reference in New Issue
Block a user