From: Kai Blin Date: Mon, 19 May 2008 13:30:30 +0000 (+0200) Subject: net: Make "net status" use functable3 X-Git-Tag: samba-4.0.0alpha6~801^2~1124 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=b0d81625252e5afe94ab27e6d3d134de99d5abb9 net: Make "net status" use functable3 (This used to be commit e4b4fb4c39f251b0675b1c1dcec14f20135f876b) --- diff --git a/source3/utils/net_status.c b/source3/utils/net_status.c index 2835b2084d9..0bd698a8e7e 100644 --- a/source3/utils/net_status.c +++ b/source3/utils/net_status.c @@ -63,6 +63,15 @@ static int net_status_sessions(struct net_context *c, int argc, const char **arg TDB_CONTEXT *tdb; bool parseable; + if (c->display_usage) { + d_printf("Usage:\n" + "net status sessions [parseable]\n" + " Display open user sessions.\n" + " If parseable is specified, output is machine-" + "readable.\n"); + return 0; + } + if (argc == 0) { parseable = false; } else if ((argc == 1) && strequal(argv[0], "parseable")) { @@ -205,6 +214,15 @@ static int net_status_shares_parseable(struct net_context *c, int argc, const ch static int net_status_shares(struct net_context *c, int argc, const char **argv) { + if (c->display_usage) { + d_printf("Usage:\n" + "net status shares [parseable]\n" + " Display open user shares.\n" + " If parseable is specified, output is machine-" + "readable.\n"); + return 0; + } + if (argc == 0) { d_printf("\nService pid machine " @@ -226,11 +244,26 @@ static int net_status_shares(struct net_context *c, int argc, const char **argv) int net_status(struct net_context *c, int argc, const char **argv) { - struct functable func[] = { - {"sessions", net_status_sessions}, - {"shares", net_status_shares}, - {"help", net_status_usage}, - {NULL, NULL} + struct functable3 func[] = { + { + "sessions", + net_status_sessions, + NET_TRANSPORT_LOCAL, + "Show list of open sessions", + "net status sessions [parseable]\n" + " If parseable is specified, output is presented " + "in a machine-parseable fashion." + }, + { + "shares", + net_status_shares, + NET_TRANSPORT_LOCAL, + "Show list of open shares", + "net status shares [parseable]\n" + " If parseable is specified, output is presented " + "in a machine-parseable fashion." + }, + {NULL, NULL, 0, NULL, NULL} }; - return net_run_function(c, argc, argv, func, net_status_usage); + return net_run_function3(c, argc, argv, "net status", func); }