From 530d46f6748a17ca8500a861f53c0d4f451b2005 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Tue, 15 Feb 2005 01:11:20 +0000 Subject: r5400: Slightly better handling of help messages in net tool. rafal (This used to be commit 5cebb4feedf7d6542c497fe55763d66f51b1c989) --- source4/utils/net/net_join.c | 12 +++++------- source4/utils/net/net_password.c | 13 +++++++------ source4/utils/net/net_time.c | 8 +++----- source4/utils/net/net_user.c | 5 +++-- 4 files changed, 18 insertions(+), 20 deletions(-) (limited to 'source4/utils') diff --git a/source4/utils/net/net_join.c b/source4/utils/net/net_join.c index cb093ef9ff..6183da87b5 100644 --- a/source4/utils/net/net_join.c +++ b/source4/utils/net/net_join.c @@ -36,8 +36,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv) switch (argc) { case 0: /* no args -> fail */ - DEBUG(0,("net_join_domain: no args\n")); - return -1; + return net_join_usage(ctx, argc, argv); case 1: /* only DOMAIN */ tmp = talloc_strdup(ctx->mem_ctx, argv[0]); break; @@ -49,12 +48,11 @@ int net_join(struct net_context *ctx, int argc, const char **argv) secure_channel_type = SEC_CHAN_WKSTA; } else { DEBUG(0, ("net_join: 2nd argument must be MEMBER or BDC\n")); - return -1; + return net_join_usage(ctx, argc, argv); } break; default: /* too many args -> fail */ - DEBUG(0,("net_join: too many args [%d]\n",argc)); - return -1; + return net_join_usage(ctx, argc, argv); } domain_name = tmp; @@ -89,12 +87,12 @@ int net_join(struct net_context *ctx, int argc, const char **argv) int net_join_usage(struct net_context *ctx, int argc, const char **argv) { - d_printf("net_password_usage: TODO\n"); + d_printf("net join [BDC | MEMBER] [options]\n"); return 0; } int net_join_help(struct net_context *ctx, int argc, const char **argv) { - d_printf("net_password_help: TODO\n"); + d_printf("Joins domain as either member or backup domain controller.\n"); return 0; } diff --git a/source4/utils/net/net_password.c b/source4/utils/net/net_password.c index 773e18d661..fdc1a2e9a0 100644 --- a/source4/utils/net/net_password.c +++ b/source4/utils/net/net_password.c @@ -29,7 +29,6 @@ * Code for Changing and setting a password */ - static int net_password_change(struct net_context *ctx, int argc, const char **argv) { NTSTATUS status; @@ -99,8 +98,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv switch (argc) { case 0: /* no args -> fail */ - DEBUG(0,("net_password_set: no args\n")); - return -1; + return net_password_usage(ctx, argc, argv); case 1: /* only DOM\\user; prompt for password */ tmp = talloc_strdup(ctx->mem_ctx, argv[0]); break; @@ -110,7 +108,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv break; default: /* too mayn args -> fail */ DEBUG(0,("net_password_set: too many args [%d]\n",argc)); - return -1; + return net_password_usage(ctx, argc, argv); } if ((p = strchr_m(tmp,'\\'))) { @@ -169,6 +167,7 @@ static int net_password_set_help(struct net_context *ctx, int argc, const char * static const struct net_functable net_password_functable[] = { {"change", net_password_change, net_password_change_usage, net_password_change_help}, {"set", net_password_set, net_password_set_usage, net_password_set_help}, + {"help", net_password_help, net_password_help, net_password_help}, {NULL, NULL} }; @@ -179,12 +178,14 @@ int net_password(struct net_context *ctx, int argc, const char **argv) int net_password_usage(struct net_context *ctx, int argc, const char **argv) { - d_printf("net_password_usage: TODO\n"); + d_printf("net password [options]\n"); return 0; } int net_password_help(struct net_context *ctx, int argc, const char **argv) { - d_printf("net_password_help: TODO\n"); + d_printf("Account password handling:\n"); + d_printf("\tchange\t\tchanges password (old password required)\n"); + d_printf("\tset\t\tsets password\n"); return 0; } diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index ec3bc0519f..ce7db4ab5c 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -28,7 +28,6 @@ * Code for getting the remote time */ - int net_time(struct net_context *ctx, int argc, const char **argv) { NTSTATUS status; @@ -41,8 +40,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) if (argc > 0 && argv[0]) { server_name = argv[0]; } else { - DEBUG(0,("net_time: server name needed!\n")); - return -1; + return net_time_usage(ctx, argc, argv); } libnetctx = libnet_context_init(); @@ -77,12 +75,12 @@ int net_time(struct net_context *ctx, int argc, const char **argv) int net_time_usage(struct net_context *ctx, int argc, const char **argv) { - d_printf("net_time_usage: TODO\n"); + d_printf("net time [options]\n"); return 0; } int net_time_help(struct net_context *ctx, int argc, const char **argv) { - d_printf("net_time_help: TODO\n"); + d_printf("Displays remote server's time.\n"); return 0; } diff --git a/source4/utils/net/net_user.c b/source4/utils/net/net_user.c index a28d774d36..845eed0665 100644 --- a/source4/utils/net/net_user.c +++ b/source4/utils/net/net_user.c @@ -69,7 +69,8 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv) static const struct net_functable net_user_functable[] = { - { "add", net_user_add, net_user_usage, net_user_help }, + { "add", net_user_add, net_user_usage, net_user_help }, + { "help", net_user_help, net_user_usage, net_user_help }, { NULL, NULL } }; @@ -83,7 +84,7 @@ int net_user(struct net_context *ctx, int argc, const char **argv) int net_user_help(struct net_context *ctx, int argc, const char **argv) { d_printf("User accounts management:\n"); - d_printf("\t\tadd\t creates new account\n"); + d_printf("\tadd\t\tcreates new account\n"); return 0; } -- cgit