--- mqtt/src/Attic/mqtt.c 2011/11/28 13:19:39 1.1.1.1.2.17 +++ mqtt/src/Attic/mqtt.c 2011/11/28 13:25:53 1.1.1.1.2.18 @@ -11,7 +11,7 @@ main(int argc, char **argv) sqlite3 *acc = NULL, *pub = NULL; FILE *logg = NULL; int ret = 0; - mqtt_subscr_t *s; + mqtt_subscr_t *s, *p; if (LoadConfig("/etc/mqtt.conf", &cfg)) { printf("Error:: Load config #%d - %s\n", cfg_GetErrno(), cfg_GetError()); @@ -86,11 +86,18 @@ main(int argc, char **argv) goto end; } else call.LOG(logg, "Publish: %d\n", ret); - if ((s = call.ReadPUB(&cfg, pub, "%", -1))) { + if (!(s = call.ReadPUB(&cfg, pub, "%", -1))) { printf("Error:: Subscribe problem\n"); goto end; - } else + } else { call.LOG(logg, "Subscribe: %p\n", s); + for (p = s; p->sub_topic._base; p++) { + printf("Retain=%d Topic(%d)=%s Value(%d)=%s\n", p->sub_ret, + p->sub_topic._size, p->sub_topic._base, + p->sub_value._size, p->sub_value._base); + } + mqtt_subFree(&s); + } if ((ret = call.DeletePUB(&cfg, pub, "boh", "misho", "1.1.1._", 0)) == -1) { printf("Error:: Delete problem\n"); goto end;