[PATCH 4/5] s4: make net help include help for switches as well

Matthieu Patou mat at matws.net
Fri Jan 8 11:31:17 MST 2010


---
 source4/utils/net/net.c |    7 +++++--
 source4/utils/net/net.h |    2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c
index 39c5aec..850fc0c 100644
--- a/source4/utils/net/net.c
+++ b/source4/utils/net/net.c
@@ -271,6 +271,7 @@ int net_help(struct net_context *ctx, const struct net_functable *ftable)
 	d_printf("Available commands:\n");
 	net_help_builtin(ftable);
 	net_help_python();
+	poptPrintHelp(*(ctx->con),stdout,0);
 	return 0;
 }
 
@@ -294,9 +295,9 @@ static int binary_net(int argc, const char **argv)
 	const char **argv_new;
 	struct tevent_context *ev;
 	struct net_context *ctx = NULL;
+	char str[10];
 	poptContext pc;
 	struct poptOption long_options[] = {
-		POPT_AUTOHELP
 		POPT_COMMON_SAMBA
 		POPT_COMMON_CONNECTION
 		POPT_COMMON_CREDENTIALS
@@ -371,7 +372,9 @@ static int binary_net(int argc, const char **argv)
 	ctx->lp_ctx = cmdline_lp_ctx;
 	ctx->credentials = cmdline_credentials;
 	ctx->event_ctx = ev;
-
+	ctx->con = &pc;
+	snprintf(str,10,"%c        \0",13);
+	poptSetOtherOptionHelp(pc, str );
 
 
 	rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable,
diff --git a/source4/utils/net/net.h b/source4/utils/net/net.h
index 16223a1..d1991cb 100644
--- a/source4/utils/net/net.h
+++ b/source4/utils/net/net.h
@@ -20,11 +20,13 @@
 
 #ifndef _UTIL_NET_H
 #define _UTIL_NET_H
+#include <popt.h>
 
 struct net_context {
 	struct cli_credentials *credentials;
 	struct loadparm_context *lp_ctx;
 	struct tevent_context *event_ctx;
+	poptContext *con;
 };
 
 struct net_functable {
-- 
1.6.3.3


--------------050508060406060009090606--


More information about the samba-technical mailing list