version 1.2.2.6, 2012/05/08 11:45:57
|
version 1.2.2.8, 2012/05/22 14:15:04
|
Line 19 Usage(void)
|
Line 19 Usage(void)
|
"=== %s@%s === Compiled: %s ===\n\n" |
"=== %s@%s === Compiled: %s ===\n\n" |
" Syntax: mqtt_subs [options] <connect_to_broker[:port]> <ConnectID> [exec_script <value>]\n\n" |
" Syntax: mqtt_subs [options] <connect_to_broker[:port]> <ConnectID> [exec_script <value>]\n\n" |
"\t-l <value2file>\t\tSave received values to file\n" |
"\t-l <value2file>\t\tSave received values to file\n" |
"\t-u\t\tUnsubscribe given topic(s)\n" | "\t-u\t\t\tUnsubscribe given topic(s)\n" |
"\t-s <topic[|QoS]>\tSubscribe for this topic, if wish add different |QoS to topic\n" |
"\t-s <topic[|QoS]>\tSubscribe for this topic, if wish add different |QoS to topic\n" |
"\t-d\t\t\tSend duplicate message\n\n" |
"\t-d\t\t\tSend duplicate message\n\n" |
"\t-C\t\t\tNot clear before connect!\n" |
"\t-C\t\t\tNot clear before connect!\n" |
Line 83 Unsubscribe(int sock)
|
Line 83 Unsubscribe(int sock)
|
srandomdev(); |
srandomdev(); |
mid = random() % USHRT_MAX; |
mid = random() % USHRT_MAX; |
|
|
|
printf(" > Execute UNSUBSCRIBE request #%d ... ", mid); |
if (mqtt_cli_Unsubscribe(args->cli, args->subscr, mid, args->Dup, MQTT_QOS_ACK)) { |
if (mqtt_cli_Unsubscribe(args->cli, args->subscr, mid, args->Dup, MQTT_QOS_ACK)) { |
printf("Error:: Unsubscribe #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
printf("Error:: Unsubscribe #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
return -1; |
return -1; |
} | } else |
| printf("OK\n"); |
|
|
return 0; |
return 0; |
} |
} |
Line 270 main(int argc, char **argv)
|
Line 272 main(int argc, char **argv)
|
else |
else |
lf = stdout; |
lf = stdout; |
if (lf) { |
if (lf) { |
ret = un ? Unsubscribe(args->cli->sock) : Subscribe(args->cli->sock, lf); | ret = Subscribe(args->cli->sock, lf); |
| if (un) |
| Unsubscribe(args->cli->sock); |
fclose(lf); |
fclose(lf); |
} else |
} else |
printf("Error:: in subscribe file #%d - %s\n", errno, strerror(errno)); |
printf("Error:: in subscribe file #%d - %s\n", errno, strerror(errno)); |