From: Jonathan McDowell Date: Wed, 30 May 2018 19:41:33 +0000 (+0100) Subject: Add command line parameters for MQTT username + password X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=35f4b6d147a8ab61fadc8a72118c18bd930e9160;p=mqtt-arp.git Add command line parameters for MQTT username + password --- diff --git a/mqtt-arp.c b/mqtt-arp.c index 2badfac..114e0ef 100644 --- a/mqtt-arp.c +++ b/mqtt-arp.c @@ -280,8 +280,10 @@ struct option long_options[] = { { "host", required_argument, 0, 'h' }, { "location", required_argument, 0, 'l' }, { "mac", required_argument, 0, 'm' }, + { "password", required_argument, 0, 'P' }, { "port", required_argument, 0, 'p' }, { "topic", required_argument, 0, 't' }, + { "username", required_argument, 0, 'u' }, { "verbose", no_argument, 0, 'v' }, { 0, 0, 0, 0 } }; @@ -299,7 +301,7 @@ int main(int argc, char *argv[]) config.mqtt_port = MQTT_PORT; while (1) { - c = getopt_long(argc, argv, "c:h:l:m:p:t:v", + c = getopt_long(argc, argv, "c:h:l:m:p:P:t:u:v", long_options, &option_index); if (c == -1) @@ -335,9 +337,15 @@ int main(int argc, char *argv[]) case 'p': config.mqtt_port = atoi(optarg); break; + case 'P': + config.mqtt_password = optarg; + break; case 't': config.mqtt_topic = optarg; break; + case 'u': + config.mqtt_username = optarg; + break; case 'v': debug = true; break;