summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDavid Wragg <dpw@lshift.net>2010-02-23 08:23:09 +0000
committerDavid Wragg <dpw@lshift.net>2010-02-23 08:23:09 +0000
commitd30240f368ceafa3b201ce4feee8e37b4da84da7 (patch)
tree59be02a96252e36298c2ae625e2d606a5f3862df /tools
parent773edb56c3bd483056a91a820e50c6ba1137e368 (diff)
downloadrabbitmq-c-github-ask-d30240f368ceafa3b201ce4feee8e37b4da84da7.tar.gz
amqp-consume should display usage info when the command is omitted.
Diffstat (limited to 'tools')
-rw-r--r--tools/common.c7
-rw-r--r--tools/consume.c5
2 files changed, 6 insertions, 6 deletions
diff --git a/tools/common.c b/tools/common.c
index 642da38..0772738 100644
--- a/tools/common.c
+++ b/tools/common.c
@@ -374,9 +374,7 @@ poptContext process_options(int argc, const char **argv,
{
int c;
poptContext opts = poptGetContext(NULL, argc, argv, options, 0);
-
- if (!help)
- poptSetOtherOptionHelp(opts, "[OPTIONS]... <command> <args>");
+ poptSetOtherOptionHelp(opts, help);
while ((c = poptGetNextOpt(opts)) >= 0) {
// no options require explicit handling
@@ -396,7 +394,8 @@ poptContext process_options(int argc, const char **argv,
void process_all_options(int argc, const char **argv,
struct poptOption *options)
{
- poptContext opts = process_options(argc, argv, options, NULL);
+ poptContext opts = process_options(argc, argv, options,
+ "[OPTIONS]...");
const char *opt = poptPeekArg(opts);
if (opt) {
diff --git a/tools/consume.c b/tools/consume.c
index fab1607..7ede926 100644
--- a/tools/consume.c
+++ b/tools/consume.c
@@ -111,8 +111,9 @@ int main(int argc, const char **argv)
"[OPTIONS]... <command> <args>");
cmd_argv = poptGetArgs(opts);
- if (!cmd_argv[0]) {
- fprintf(stderr, "consuming command not specified");
+ if (!cmd_argv || !cmd_argv[0]) {
+ fprintf(stderr, "consuming command not specified\n");
+ poptPrintUsage(opts, stderr, 0);
goto error;
}