|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2008 Christophe Fillot. ! 3: * E-mail: [email protected] ! 4: * ! 5: * UUID handling. ! 6: */ ! 7: ! 8: #include <stdio.h> ! 9: #include <stdlib.h> ! 10: #include <string.h> ! 11: #include <unistd.h> ! 12: #include <sys/types.h> ! 13: ! 14: #include "gen_uuid.h" ! 15: ! 16: /* Our local UUID */ ! 17: static uuid_t local_uuid; ! 18: ! 19: /* Get local ID */ ! 20: void gen_uuid_get_local(uuid_t dst) ! 21: { ! 22: uuid_copy(dst,local_uuid); ! 23: } ! 24: ! 25: /* Compare UUID */ ! 26: int gen_uuid_compare(uuid_t id) ! 27: { ! 28: return(uuid_compare(local_uuid,id)); ! 29: } ! 30: ! 31: /* Initialize UUID */ ! 32: void gen_uuid_init(void) ! 33: { ! 34: char buffer[40]; ! 35: ! 36: uuid_generate(local_uuid); ! 37: uuid_unparse(local_uuid,buffer); ! 38: printf("Local UUID: %s\n\n",buffer); ! 39: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.