2 Samba Unix/Linux SMB client library
4 Copyright (C) 2002 Jim McDonough (jmcd@us.ibm.com)
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "utils/net.h"
23 static int net_usage(struct net_context
*c
, int argc
, const char **argv
);
25 static int net_help_usage(struct net_context
*c
, int argc
, const char **argv
)
27 c
->display_usage
= true;
28 return net_usage(c
, argc
, argv
);
31 static int net_usage(struct net_context
*c
, int argc
, const char **argv
)
33 struct functable
*table
= (struct functable
*) c
->private_data
;
36 d_printf(_("Usage:\n"));
37 for (i
=0; table
[i
].funcname
!= NULL
; i
++) {
38 if (c
->display_usage
) {
39 d_printf(_("net %s usage:\n"), table
[i
].funcname
);
40 d_printf("\n%s\n\n", _(table
[i
].usage
));
42 d_printf("%s %-15s %s\n", "net", table
[i
].funcname
,
43 _(table
[i
].description
));
48 net_common_flags_usage(c
, argc
, argv
);
53 handle "net help *" subcommands
55 int net_help(struct net_context
*c
, int argc
, const char **argv
)
57 struct functable
*func
= (struct functable
*)c
->private_data
;
60 return net_usage(c
, argc
, argv
);
63 if (strcasecmp_m(argv
[0], "help") == 0) {
64 return net_help_usage(c
, argc
, argv
);
67 c
->display_usage
= true;
68 return net_run_function(c
, argc
, argv
, "net help", func
);