r5400: Slightly better handling of help messages in net tool.
authorRafal Szczesniak <mimir@samba.org>
Tue, 15 Feb 2005 01:11:20 +0000 (01:11 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:10:41 +0000 (13:10 -0500)
rafal
(This used to be commit 5cebb4feedf7d6542c497fe55763d66f51b1c989)

source4/utils/net/net_join.c
source4/utils/net/net_password.c
source4/utils/net/net_time.c
source4/utils/net/net_user.c

index cb093ef9ff2d4f4ef59f44ad754d9bd590b72049..6183da87b527e742f184e119af28486e8f4793c9 100644 (file)
@@ -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 <domain> [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;       
 }
index 773e18d6610f74131c7bcaef76a56fdc71f942ea..fdc1a2e9a093959423fd5bf3801142f24ac8724f 100644 (file)
@@ -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 <command> [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;       
 }
index ec3bc0519fa09e21fa8daa7082700915001bde18..ce7db4ab5c08462e6f36ddb79fb2de119e06d72a 100644 (file)
@@ -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 <server> [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;       
 }
index a28d774d367758500947c705c421830081f4cf35..845eed06655765960e74235ce18cadfafba3e9f3 100644 (file)
@@ -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;
 }