File:  [ELWIX - Embedded LightWeight unIX -] / libaitmqtt / example / test_declen.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, MAIN
CVS tags: start, mqtt1_8, mqtt1_7, mqtt1_6, mqtt1_5, mqtt1_4, mqtt1_3, mqtt1_2, mqtt1_1, MQTT1_7, MQTT1_6, MQTT1_5, MQTT1_4, MQTT1_3, MQTT1_2, MQTT1_1, MQTT1_0, HEAD
MQTT library

    1: #include <stdio.h>
    2: #include <stdlib.h>
    3: #include <netinet/in.h>
    4: #include "aitmqtt.h"
    5: 
    6: int
    7: main(int argc, char **argv)
    8: {
    9: 	unsigned int x;
   10: 	unsigned char *p = (unsigned char*) &x;
   11: 	int s;
   12: 
   13: 	if (argc < 2)
   14: 		return 1;
   15: 	else
   16: 		x = strtol(argv[1], NULL, 0);
   17: 
   18: 	printf("decode:: (wire)-> %02x %02x %02x %02x ", p[0], p[1], p[2], p[3]);
   19: 	x = mqtt_decodeLen(&x, &s);
   20: 	printf("length is x=%u sizeof=%d\n", x, s);
   21: 
   22: 	return 0;
   23: }

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