Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * uuid_to_str.c -- convert a UUID to string |
| 3 | */ |
| 4 | |
| 5 | #include <stdio.h> |
| 6 | |
| 7 | #include "uuidP.h" |
| 8 | |
| 9 | void uuid_unparse(uuid_t uu, char *out) |
| 10 | { |
| 11 | struct uuid uuid; |
| 12 | |
| 13 | uuid_unpack(uu, &uuid); |
| 14 | sprintf(out, |
| 15 | "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", |
| 16 | uuid.time_low, uuid.time_mid, uuid.time_hi_and_version, |
| 17 | uuid.clock_seq >> 8, uuid.clock_seq & 0xFF, |
| 18 | uuid.node[0], uuid.node[1], uuid.node[2], |
| 19 | uuid.node[3], uuid.node[4], uuid.node[5]); |
| 20 | } |
| 21 | |