File:  [ELWIX - Embedded LightWeight unIX -] / libaitmqtt / example / test.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Thu Jan 26 13:07:33 2012 UTC (12 years, 5 months ago) by misho
Branches: misho
CVS tags: start, mqtt1_1, MQTT1_0
MQTT library

    1: #include <stdio.h>
    2: #include <stdlib.h>
    3: #include <string.h>
    4: #include <sys/types.h>
    5: #include "aitmqtt.h"
    6: 
    7: 
    8: int
    9: main(int argc, char **argv)
   10: {
   11: 	mqtt_subscr_t *v, *p;
   12: 	u_char qoses[] = { 1, 0, 2, 6, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0 };
   13: 	register int i;
   14: 
   15: 	if (argc < 2)
   16: 		return 1;
   17: 
   18: 	v = mqtt_str2sub((const char**) argv, 0, qoses);
   19: 	for (p = v; p->sub_topic.msg_base; p++)
   20: 		printf("size=%hd %s qos=%d\n", p->sub_topic.msg_len, (char*) p->sub_topic.msg_base, p->sub_ret);
   21: 	mqtt_subFree(&v);
   22: 
   23: 	v = mqtt_subAlloc(10);
   24: 	for (p = v; p->sub_topic.msg_base; p++)
   25: 		printf("i=%d\n", i++);
   26: 	mqtt_subFree(&v);
   27: 
   28: 	return 0;
   29: }

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