diff options
author | Kai Blin <kai@samba.org> | 2008-05-19 15:30:30 +0200 |
---|---|---|
committer | Kai Blin <kai@samba.org> | 2008-06-10 09:46:12 +0200 |
commit | b0d81625252e5afe94ab27e6d3d134de99d5abb9 (patch) | |
tree | fef2bec1c07372f583eef8d5ca308b8b2ebe2289 | |
parent | 6e8d46d40df86a8f6c5820852eb1eab95049be41 (diff) | |
download | samba-b0d81625252e5afe94ab27e6d3d134de99d5abb9.tar.gz samba-b0d81625252e5afe94ab27e6d3d134de99d5abb9.tar.bz2 samba-b0d81625252e5afe94ab27e6d3d134de99d5abb9.zip |
net: Make "net status" use functable3
(This used to be commit e4b4fb4c39f251b0675b1c1dcec14f20135f876b)
-rw-r--r-- | source3/utils/net_status.c | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/source3/utils/net_status.c b/source3/utils/net_status.c index 2835b2084d..0bd698a8e7 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); } |