From 0ad3918c050deddbba10e99972dd42396ebae418 Mon Sep 17 00:00:00 2001 From: Michael Santos Date: Sun, 2 Jul 2017 08:05:07 -0400 Subject: [PATCH] Fix options Terminate long option list so xmppipe doesn't segfault when passed an unknown option. Correct the usage. Revert to using --ouput for the MUC name instead of --stdout to avoid confusion. --- src/xmppipe.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/xmppipe.c b/src/xmppipe.c index da7a2c8..9243f9b 100644 --- a/src/xmppipe.c +++ b/src/xmppipe.c @@ -70,7 +70,7 @@ static const struct option long_options[] = {"interval", required_argument, NULL, 'I'}, {"keepalive", required_argument, NULL, 'k'}, {"keepalive-failures", required_argument, NULL, 'K'}, - {"stdout", required_argument, NULL, 'o'}, + {"output", required_argument, NULL, 'o'}, {"password", required_argument, NULL, 'p'}, {"poll-delay", required_argument, NULL, 'P'}, {"resource", required_argument, NULL, 'r'}, @@ -80,7 +80,8 @@ static const struct option long_options[] = {"unacked-requests", required_argument, NULL, 'U'}, {"verbose", no_argument, NULL, 'v'}, {"base64", no_argument, NULL, 'x'}, - {"help", no_argument, NULL, 'h'} + {"help", no_argument, NULL, 'h'}, + {NULL, 0, NULL, 0} }; int @@ -1247,20 +1248,20 @@ usage(xmppipe_state_t *state) __progname, XMPPIPE_VERSION, XMPPIPE_SANDBOX); (void)fprintf(stderr, "usage: %s [OPTIONS]\n" - " -u, --user username (aka JID)\n" - " -p, --passord password\n" + " -u, --username XMPP username (aka JID)\n" + " -p, --password XMPP password\n" " -r, --resource resource (aka MUC nick)\n" - " -o, --stdout MUC room to send stdout\n" + " -o, --output MUC room to send stdin\n" " -S, --subject set MUC subject\n" " -a, --address set XMPP server address (port is optional)\n" " -d, --discard discard stdin when MUC is empty\n" " -D, --discard-to-stdout discard stdin and print to local stdout\n" " -e, --ignore-eof ignore stdin EOF\n" - " -s, --exit-when-empty exit when MUC is empty\n" + " -s, --exit-when-empty exit when all participants leave MUC\n" " -x, --base64 base64 encode/decode data\n" - " -b, --buffer-size size of read buffer\n" + " -b, --buffer-size size of stdin read buffer\n" " -I, --interval request stream management status every interval messages\n" " -k, --keepalives periodically send a keepalive\n" " -K, --keepalive-failures number of keepalive failures before exiting\n"