make help only print the commands that are actually available.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8178 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-04-12 10:27:11 +00:00
parent 09b232fca4
commit 8c022714c1

View File

@@ -154,10 +154,12 @@ static SL_cmd commands[] = {
krb5_context context; krb5_context context;
void *kadm_handle; void *kadm_handle;
static SL_cmd *actual_cmds;
int int
help(int argc, char **argv) help(int argc, char **argv)
{ {
sl_help(commands, argc, argv); sl_help(actual_cmds, argc, argv);
return 0; return 0;
} }
@@ -199,7 +201,6 @@ main(int argc, char **argv)
kadm5_config_params conf; kadm5_config_params conf;
int optind = 0; int optind = 0;
int e; int e;
SL_cmd *cmd;
set_progname(argv[0]); set_progname(argv[0]);
@@ -254,7 +255,7 @@ main(int argc, char **argv)
KADM5_ADMIN_SERVICE, KADM5_ADMIN_SERVICE,
&conf, 0, 0, &conf, 0, 0,
&kadm_handle); &kadm_handle);
cmd = commands; actual_cmds = commands;
} else { } else {
ret = kadm5_c_init_with_password_ctx(context, ret = kadm5_c_init_with_password_ctx(context,
client_name, client_name,
@@ -262,17 +263,17 @@ main(int argc, char **argv)
KADM5_ADMIN_SERVICE, KADM5_ADMIN_SERVICE,
&conf, 0, 0, &conf, 0, 0,
&kadm_handle); &kadm_handle);
cmd = commands + 4; /* XXX */ actual_cmds = commands + 4; /* XXX */
} }
if(ret) if(ret)
krb5_err(context, 1, ret, "kadm5_init_with_password"); krb5_err(context, 1, ret, "kadm5_init_with_password");
if (argc != 0) { if (argc != 0) {
ret = sl_command (cmd, argc, argv); ret = sl_command (actual_cmds, argc, argv);
if(ret == -1) if(ret == -1)
krb5_warnx (context, "unrecognized command: %s", argv[0]); krb5_warnx (context, "unrecognized command: %s", argv[0]);
} else } else
ret = sl_loop (cmd, "kadmin> ") != 0; ret = sl_loop (actual_cmds, "kadmin> ") != 0;
kadm5_destroy(kadm_handle); kadm5_destroy(kadm_handle);
krb5_config_file_free (context, cf); krb5_config_file_free (context, cf);