version 1.2.2.8, 2012/05/22 14:15:04
|
version 1.2.2.9, 2012/05/27 10:04:05
|
Line 105 main(int argc, char **argv)
|
Line 105 main(int argc, char **argv)
|
char *str, szStr[STRSIZ], szLogName[MAXPATHLEN] = { 0 }; |
char *str, szStr[STRSIZ], szLogName[MAXPATHLEN] = { 0 }; |
FILE *lf; |
FILE *lf; |
|
|
if (!(args = malloc(sizeof(struct tagArgs)))) { | if (!(args = io_malloc(sizeof(struct tagArgs)))) { |
printf("Error:: in arguments #%d - %s\n", errno, strerror(errno)); |
printf("Error:: in arguments #%d - %s\n", errno, strerror(errno)); |
return 1; |
return 1; |
} else |
} else |
memset(args, 0, sizeof(struct tagArgs)); |
memset(args, 0, sizeof(struct tagArgs)); |
if (!(args->subscr = mqtt_subAlloc(idx))) { |
if (!(args->subscr = mqtt_subAlloc(idx))) { |
printf("Error:: in subscribes array #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
printf("Error:: in subscribes array #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
free(args); | io_free(args); |
return 1; |
return 1; |
} else |
} else |
args->free = cleanArgs; |
args->free = cleanArgs; |
Line 120 main(int argc, char **argv)
|
Line 120 main(int argc, char **argv)
|
if (!(args->msg = mqtt_msgAlloc(USHRT_MAX))) { |
if (!(args->msg = mqtt_msgAlloc(USHRT_MAX))) { |
printf("Error:: in mqtt buffer #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
printf("Error:: in mqtt buffer #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
args->free(args); |
args->free(args); |
free(args); | io_free(args); |
return 1; |
return 1; |
} |
} |
|
|
Line 158 main(int argc, char **argv)
|
Line 158 main(int argc, char **argv)
|
if (!sub) { |
if (!sub) { |
printf("Error:: #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
printf("Error:: #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
args->free(args); |
args->free(args); |
free(args); | io_free(args); |
return 1; |
return 1; |
} else |
} else |
sub += idx++; |
sub += idx++; |
Line 173 main(int argc, char **argv)
|
Line 173 main(int argc, char **argv)
|
sub->sub_ret = (u_char) *str; |
sub->sub_ret = (u_char) *str; |
} else |
} else |
sub->sub_ret = (u_char) args->QoS; |
sub->sub_ret = (u_char) args->QoS; |
sub->sub_topic.msg_base = strdup(szStr); | sub->sub_topic.msg_base = io_strdup(szStr); |
sub->sub_topic.msg_len = strlen(szStr); |
sub->sub_topic.msg_len = strlen(szStr); |
break; |
break; |
case 'q': |
case 'q': |
Line 181 main(int argc, char **argv)
|
Line 181 main(int argc, char **argv)
|
if (args->QoS > MQTT_QOS_EXACTLY) { |
if (args->QoS > MQTT_QOS_EXACTLY) { |
printf("Error:: invalid QoS level %d\n", args->QoS); |
printf("Error:: invalid QoS level %d\n", args->QoS); |
args->free(args); |
args->free(args); |
free(args); | io_free(args); |
return 1; |
return 1; |
} |
} |
break; |
break; |
Line 206 main(int argc, char **argv)
|
Line 206 main(int argc, char **argv)
|
case 'h': |
case 'h': |
default: |
default: |
args->free(args); |
args->free(args); |
free(args); | io_free(args); |
Usage(); |
Usage(); |
return 1; |
return 1; |
} |
} |
Line 215 main(int argc, char **argv)
|
Line 215 main(int argc, char **argv)
|
if (argc < 2) { |
if (argc < 2) { |
printf("Error:: host for connect not found, connection id or topic not supplied!\n\n"); |
printf("Error:: host for connect not found, connection id or topic not supplied!\n\n"); |
args->free(args); |
args->free(args); |
free(args); | io_free(args); |
Usage(); |
Usage(); |
return 1; |
return 1; |
} else { |
} else { |
Line 229 main(int argc, char **argv)
|
Line 229 main(int argc, char **argv)
|
if (!io_gethostbyname(*argv, port, &args->addr)) { |
if (!io_gethostbyname(*argv, port, &args->addr)) { |
printf("Error:: host not valid #%d - %s\n", io_GetErrno(), io_GetError()); |
printf("Error:: host not valid #%d - %s\n", io_GetErrno(), io_GetError()); |
args->free(args); |
args->free(args); |
free(args); | io_free(args); |
Usage(); |
Usage(); |
return 1; |
return 1; |
} |
} |
Line 238 main(int argc, char **argv)
|
Line 238 main(int argc, char **argv)
|
|
|
if (!(args->cli = mqtt_cli_Open(&args->addr.sa, args->ka))) { |
if (!(args->cli = mqtt_cli_Open(&args->addr.sa, args->ka))) { |
args->free(args); |
args->free(args); |
free(args); | io_free(args); |
return 2; |
return 2; |
} |
} |
|
|
Line 284 main(int argc, char **argv)
|
Line 284 main(int argc, char **argv)
|
mqtt_cli_Close(&args->cli); |
mqtt_cli_Close(&args->cli); |
|
|
args->free(args); |
args->free(args); |
free(args); | io_free(args); |
return ret; |
return ret; |
} |
} |