2009-07-23 18:22:24 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2009-07-24 18:21:50 +00:00
|
|
|
#include<string.h>
|
2009-07-23 18:22:24 +00:00
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
#include <uuid.h>
|
|
|
|
#else
|
|
|
|
#include <uuid/uuid.h>
|
|
|
|
#endif
|
|
|
|
|
2009-07-24 18:21:50 +00:00
|
|
|
void
|
|
|
|
get_uuid(char *temp)
|
2009-07-23 18:22:24 +00:00
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
uuid_t uu;
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
uuid_create(&uu, NULL);
|
|
|
|
uuid_to_string(&uu, &s, 0);
|
|
|
|
#else
|
|
|
|
s = (char *) malloc(37); /* UUID is 36 chars + \0 */
|
|
|
|
uuid_generate(uu);
|
2009-07-24 18:21:50 +00:00
|
|
|
uuid_unparse(uu, s);
|
2009-07-23 18:22:24 +00:00
|
|
|
#endif
|
2009-07-24 18:21:50 +00:00
|
|
|
memcpy(temp, s, 37);
|
2009-07-23 18:22:24 +00:00
|
|
|
}
|