[PATCH 3/5] s4: improve net output

Matthieu Patou mat at matws.net
Fri Jan 8 09:47:14 MST 2010


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

diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c
index fc34e84..39c5aec 100644
--- a/source4/utils/net/net.c
+++ b/source4/utils/net/net.c
@@ -166,13 +166,16 @@ int net_run_usage(struct net_context *ctx,
 			const struct net_functable *functable)
 {
 	int i;
+	bool found = false;
 	PyObject *py_cmds, *py_cmd;
 
 	for (i=0; functable[i].name; i++) {
-		if (strcasecmp_m(argv[0], functable[i].name) == 0)
+		if (strcasecmp_m(argv[0], functable[i].name) == 0) {
+			found = true;
 			if (functable[i].usage) {
 				return functable[i].usage(ctx, argc-1, argv+1);
 			}
+		}
 	}
 
 	py_cmds = py_commands();
@@ -186,7 +189,7 @@ int net_run_usage(struct net_context *ctx,
                                                 argv+1);
 	}
 
-	d_printf("No usage information for command: %s\n", argv[0]);
+	d_printf("%s: %s\n", (found == true)?"No usage information for command":"Unknown command",argv[0]);
 
 	return 1;
 }
-- 
1.6.3.3


--------------050508060406060009090606
Content-Type: text/x-patch;
 name="0002-s4-make-net-help-foo-work-and-use-net_run_usage.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0002-s4-make-net-help-foo-work-and-use-net_run_usage.patch"



More information about the samba-technical mailing list