File:  [ELWIX - Embedded LightWeight unIX -] / libaitmqtt / example / test.c
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Thu Jan 26 13:07:33 2012 UTC (12 years, 9 months ago) by misho
Branches: MAIN
CVS tags: HEAD
Initial revision

#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;

	if (argc < 2)
		return 1;

	v = mqtt_str2sub((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>