0.14.4: standardize exit status

* 2: usage errors
* 0: usage (-h)
master
Michael Santos 2 years ago
parent 771822da1a
commit 840ef08251

@ -150,8 +150,10 @@ int main(int argc, char **argv) {
state->format = XMPPIPE_FMT_TEXT; state->format = XMPPIPE_FMT_TEXT;
else if (strcmp(optarg, "csv") == 0) else if (strcmp(optarg, "csv") == 0)
state->format = XMPPIPE_FMT_CSV; state->format = XMPPIPE_FMT_CSV;
else else {
usage(state); usage(state);
exit(2);
}
break; break;
case 'x': case 'x':
@ -214,6 +216,7 @@ int main(int argc, char **argv) {
case 'h': case 'h':
default: default:
usage(state); usage(state);
exit(0);
} }
} }
@ -225,11 +228,15 @@ int main(int argc, char **argv) {
state->room = xmppipe_strdup(argv[0]); state->room = xmppipe_strdup(argv[0]);
} }
if (jid == NULL) if (jid == NULL) {
usage(state); usage(state);
exit(2);
}
if (state->encode && BASE64_LENGTH(state->bufsz) + 1 > 0xffff) if (state->encode && BASE64_LENGTH(state->bufsz) + 1 > 0xffff) {
usage(state); usage(state);
exit(2);
}
state->server = xmppipe_servername(jid); state->server = xmppipe_servername(jid);
@ -595,6 +602,4 @@ static void usage(xmppipe_state_t *state) {
" --no-tls-verify disable TLS certificate " " --no-tls-verify disable TLS certificate "
"verification\n", "verification\n",
__progname); __progname);
exit(EXIT_FAILURE);
} }

@ -27,7 +27,7 @@
#include "strtonum.h" #include "strtonum.h"
#endif #endif
#define XMPPIPE_VERSION "0.14.3" #define XMPPIPE_VERSION "0.14.4"
#define XMPPIPE_RESOURCE "xmppipe" #define XMPPIPE_RESOURCE "xmppipe"
#define XMPPIPE_STREQ(a, b) (strcmp((a), (b)) == 0) #define XMPPIPE_STREQ(a, b) (strcmp((a), (b)) == 0)

Loading…
Cancel
Save