File:  [ELWIX - Embedded LightWeight unIX -] / libaitmqtt / example / test_declen.c
Revision 1.1.1.1.16.1: download - view: text, annotated - select for diffs - revision graph
Wed Sep 14 16:16:55 2016 UTC (7 years, 9 months ago) by misho
Branches: mqtt1_8
Diff to: branchpoint 1.1.1.1: preferred, colored
adds linux makefile

#include <stdio.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <limits.h>
#include <aitmqtt.h>

int
main(int argc, char **argv)
{
	unsigned int x;
	unsigned char *p = (unsigned char*) &x;
	int s;

	if (argc < 2)
		return 1;
	else
		x = strtol(argv[1], NULL, 0);

	printf("decode:: (wire)-> %02x %02x %02x %02x ", p[0], p[1], p[2], p[3]);
	x = mqtt_decodeLen(&x, &s);
	printf("length is x=%u sizeof=%d\n", x, s);

	return 0;
}

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