File:  [ELWIX - Embedded LightWeight unIX -] / libelwix / example / test_uuid.c
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Mon Nov 17 20:02:47 2025 UTC (2 weeks, 1 day ago) by misho
Branches: MAIN
CVS tags: elwix6_13, HEAD, ELWIX6_12
Version 6.12

#include <stdio.h>
#include <stdlib.h>
#include <elwix.h>


int
main(int argc, char **argv)
{
	u_char buf[BUFSIZ], len=8;
	int i;
	uuid_t uuid;

	printf("Random long=%x\n", e_random());
	if (argc > 1)
		len = MIN(atoi(argv[1]), sizeof buf);
	printf("Random buf ret=%d 0x", e_randbuf(buf, len));
	for (i = 0; i < len; i++)
		printf("%02x", buf[i]);
	printf("\n");

	printf("UUID gen ret=%d 0x", uuid_gen(uuid));
	for (i = 0; i < sizeof uuid; i++)
		printf("%02x", uuid[i]);
	printf("\n");

	printf("UUID string ret=%d ", uuid_str(uuid, buf, sizeof buf));
	printf("%s\n", buf);

	return 0;
}

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