summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2007-05-19 04:59:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:15 -0500
commitfa4df182e5777f534edd327446f5b1d1e79c6133 (patch)
treed817c148f4dcb8d49c4b5e2e6386736ad5a56d67 /source3/utils
parente61f235796ff2da34fb207f48e2bba832c30740b (diff)
downloadsamba-fa4df182e5777f534edd327446f5b1d1e79c6133.tar.gz
samba-fa4df182e5777f534edd327446f5b1d1e79c6133.tar.bz2
samba-fa4df182e5777f534edd327446f5b1d1e79c6133.zip
r23010: Make the output of "smbcontrol --help" match that of "smbcontrol help".
Bug #3181. (This used to be commit 94b0997ef1bd993587dfeef4e0a8d366c5371e9f)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/smbcontrol.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 5d06576825..637cdacffa 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -1062,11 +1062,11 @@ static const struct {
/* Display usage information */
-static void usage(poptContext *pc)
+static void usage(poptContext pc)
{
int i;
- poptPrintHelp(*pc, stderr, 0);
+ poptPrintHelp(pc, stderr, 0);
fprintf(stderr, "\n");
fprintf(stderr, "<destination> is one of \"nmbd\", \"smbd\", \"winbindd\" or a "
@@ -1160,6 +1160,29 @@ static BOOL do_command(struct messaging_context *msg_ctx,
return False;
}
+static void smbcontrol_help(poptContext pc,
+ enum poptCallbackReason preason,
+ struct poptOption * poption,
+ const char * parg,
+ void * pdata)
+{
+ if (poption->shortName != '?') {
+ poptPrintUsage(pc, stdout, 0);
+ } else {
+ usage(pc);
+ }
+
+ exit(0);
+}
+
+struct poptOption help_options[] = {
+ { NULL, '\0', POPT_ARG_CALLBACK, (void *)&smbcontrol_help, '\0',
+ NULL, NULL },
+ { "help", '?', 0, NULL, '?', "Show this help message", NULL },
+ { "usage", '\0', 0, NULL, 'u', "Display brief usage message", NULL },
+ { NULL }
+} ;
+
/* Main program */
int main(int argc, const char **argv)
@@ -1170,7 +1193,9 @@ int main(int argc, const char **argv)
struct messaging_context *msg_ctx;
static struct poptOption long_options[] = {
- POPT_AUTOHELP
+ /* POPT_AUTOHELP */
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, help_options,
+ 0, "Help options:", NULL },
{ "timeout", 't', POPT_ARG_INT, &timeout, 't',
"Set timeout value in seconds", "TIMEOUT" },
@@ -1191,7 +1216,7 @@ int main(int argc, const char **argv)
"<parameters>");
if (argc == 1)
- usage(&pc);
+ usage(pc);
while ((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
@@ -1215,7 +1240,7 @@ int main(int argc, const char **argv)
}
if (argc == 1)
- usage(&pc);
+ usage(pc);
lp_load(dyn_CONFIGFILE,False,False,False,True);