diff --git a/ChangeLog.txt b/ChangeLog.txt index 7936864a..c27f515e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -133,6 +133,7 @@ Clients: - Fix incorrect output formatting in mosquitto_sub when using field widths with `%x` and `%X` for printing the payload in hex. - Add float printing option to mosquitto_sub. +- Fix `-f` and `-s` options in mosquitto_rr. 2.0.14 - 2021-11-17 diff --git a/client/rr_client.c b/client/rr_client.c index ad3fc7f9..05c2d51b 100644 --- a/client/rr_client.c +++ b/client/rr_client.c @@ -194,8 +194,9 @@ static void print_usage(void) printf(" Defaults to MQTT v5, where the Request-Response feature will be used, but v3.1.1 can also be used\n"); printf(" with v3.1.1 brokers.\n"); printf("mosquitto_rr version %s running on libmosquitto %d.%d.%d.\n\n", VERSION, major, minor, revision); - printf("Usage: mosquitto_rr {[-h host] [--unix path] [-p port] [-u username] [-P password] [--ws] -t topic | -L URL} -e response-topic\n"); - printf(" [-c] [-k keepalive] [-q qos] [-R] [-x session-expiry-interval\n"); + printf("Usage: mosquitto_rr {[-h host] [--unix path] [-p port] [-u username] [-P password] -t topic | -L URL} -e response-topic\n"); + printf(" {-f file | -l | -n | -m message}\n"); + printf(" [-c] [-k keepalive] [-q qos] [-R] [-x session-expiry-interval]\n"); printf(" [-F format]\n"); #ifndef WIN32 printf(" [-W timeout_secs]\n"); @@ -330,6 +331,18 @@ int main(int argc, char *argv[]) goto cleanup; } + if(cfg.pub_mode == MSGMODE_STDIN_FILE){ + if(load_stdin()){ + err_printf(&cfg, "Error loading input from stdin.\n"); + goto cleanup; + } + }else if(cfg.file_input){ + if(load_file(cfg.file_input)){ + err_printf(&cfg, "Error loading input file \"%s\".\n", cfg.file_input); + goto cleanup; + } + } + if(!cfg.topic || cfg.pub_mode == MSGMODE_NONE || !cfg.response_topic){ fprintf(stderr, "Error: All of topic, message, and response topic must be supplied.\n"); fprintf(stderr, "\nUse 'mosquitto_rr --help' to see usage.\n");