mirror of
https://github.com/eclipse/mosquitto.git
synced 2025-05-09 09:11:11 +08:00
Don't display usage information on every error.
This commit is contained in:
parent
65a4b790f3
commit
d9d1f2f7b8
@ -279,8 +279,14 @@ int main(int argc, char *argv[])
|
|||||||
int rc;
|
int rc;
|
||||||
int rc2;
|
int rc2;
|
||||||
|
|
||||||
if(client_config_load(&cfg, CLIENT_PUB, argc, argv)){
|
rc = client_config_load(&cfg, CLIENT_PUB, argc, argv);
|
||||||
print_usage();
|
if(rc){
|
||||||
|
if(rc == 2){
|
||||||
|
/* --help */
|
||||||
|
print_usage();
|
||||||
|
}else{
|
||||||
|
fprintf(stderr, "\nUse 'mosquitto_pub --help' to see usage.\n");
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,8 +202,14 @@ int main(int argc, char *argv[])
|
|||||||
struct mosquitto *mosq = NULL;
|
struct mosquitto *mosq = NULL;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if(client_config_load(&cfg, CLIENT_SUB, argc, argv)){
|
rc = client_config_load(&cfg, CLIENT_SUB, argc, argv);
|
||||||
print_usage();
|
if(rc){
|
||||||
|
if(rc == 2){
|
||||||
|
/* --help */
|
||||||
|
print_usage();
|
||||||
|
}else{
|
||||||
|
fprintf(stderr, "\nUse 'mosquitto_sub --help' to see usage.\n");
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user