1/* 2 * unparse.c -- convert a UUID to string 3 * 4 * Copyright (C) 1996, 1997 Theodore Ts'o. 5 * 6 * %Begin-Header% 7 * This file may be redistributed under the terms of the GNU 8 * Library General Public License. 9 * %End-Header% 10 */ 11 12#include <stdio.h> 13 14#include "uuidP.h" 15 16void uuid_unparse(const uuid_t uu, char *out) 17{ 18 struct uuid uuid; 19 20 uuid_unpack(uu, &uuid); 21 sprintf(out, 22 "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", 23 uuid.time_low, uuid.time_mid, uuid.time_hi_and_version, 24 uuid.clock_seq >> 8, uuid.clock_seq & 0xFF, 25 uuid.node[0], uuid.node[1], uuid.node[2], 26 uuid.node[3], uuid.node[4], uuid.node[5]); 27} 28 29