File:  [ELWIX - Embedded LightWeight unIX -] / libaitmqtt / example / test.c
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Wed Jun 20 15:02:23 2012 UTC (11 years, 10 months ago) by misho
Branches: MAIN
CVS tags: mqtt1_8, mqtt1_7, mqtt1_6, mqtt1_5, mqtt1_4, mqtt1_3, mqtt1_2, MQTT1_7, MQTT1_6, MQTT1_5, MQTT1_4, MQTT1_3, MQTT1_2, MQTT1_1, HEAD
version 1.1

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "aitmqtt.h"


int
main(int argc, char **argv)
{
	mqtt_subscr_t *v, *p;
	u_char qoses[] = { 1, 0, 2, 6, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0 };
	register int i;

	v = mqtt_str2subs((const char**) argv, 0, qoses);
	for (p = v; p->sub_topic.msg_base; p++)
		printf("size=%hd %s qos=%d\n", p->sub_topic.msg_len, (char*) p->sub_topic.msg_base, p->sub_ret);
	mqtt_subFree(&v);

	v = mqtt_subAlloc(10);
	for (p = v; p->sub_topic.msg_base; p++)
		printf("i=%d\n", i++);
	mqtt_subFree(&v);

	return 0;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>