Add the uuid_unparse_upper and uuid_unparse_lower functions to the
uuid library.

diff --git a/lib/uuid/ChangeLog b/lib/uuid/ChangeLog
index e6de9f0..7a043a1 100644
--- a/lib/uuid/ChangeLog
+++ b/lib/uuid/ChangeLog
@@ -1,3 +1,8 @@
+2004-03-22  Theodore Ts'o  <tytso@mit.edu>
+
+	* unparse.c (uuid_unparse_lower, uuid_unparse_upper),
+		uuid_unparse.3.in, uuid.h: Add new functions.
+
 2004-03-19  Theodore Ts'o  <tytso@mit.edu>
 
 	* Change the license to be the 3-clause BSD-style license
diff --git a/lib/uuid/unparse.c b/lib/uuid/unparse.c
index b5b9f58..c0e08ef 100644
--- a/lib/uuid/unparse.c
+++ b/lib/uuid/unparse.c
@@ -36,16 +36,41 @@
 
 #include "uuidP.h"
 
-void uuid_unparse(const uuid_t uu, char *out)
+static const char *fmt_lower = 
+	"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
+
+static const char *fmt_upper = 
+	"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
+
+#ifdef UUID_UNPARSE_DEFAULT_UPPER
+#define FMT_DEFAULT fmt_upper
+#else
+#define FMT_DEFAULT fmt_lower
+#endif
+
+static void uuid_unparse_x(const uuid_t uu, char *out, const char *fmt)
 {
 	struct uuid uuid;
 
 	uuid_unpack(uu, &uuid);
-	sprintf(out,
-		"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+	sprintf(out, fmt,
 		uuid.time_low, uuid.time_mid, uuid.time_hi_and_version,
 		uuid.clock_seq >> 8, uuid.clock_seq & 0xFF,
 		uuid.node[0], uuid.node[1], uuid.node[2],
 		uuid.node[3], uuid.node[4], uuid.node[5]);
 }
 
+void uuid_unparse_lower(const uuid_t uu, char *out)
+{
+	uuid_unparse_x(uu, out,	fmt_lower);
+}
+
+void uuid_unparse_upper(const uuid_t uu, char *out)
+{
+	uuid_unparse_x(uu, out,	fmt_upper);
+}
+
+void uuid_unparse(const uuid_t uu, char *out)
+{
+	uuid_unparse_x(uu, out, FMT_DEFAULT);
+}
diff --git a/lib/uuid/uuid.h b/lib/uuid/uuid.h
index a037c7b..ff5459e 100644
--- a/lib/uuid/uuid.h
+++ b/lib/uuid/uuid.h
@@ -81,6 +81,8 @@
 
 /* unparse.c */
 void uuid_unparse(const uuid_t uu, char *out);
+void uuid_unparse_lower(const uuid_t uu, char *out);
+void uuid_unparse_upper(const uuid_t uu, char *out);
 
 /* uuid_time.c */
 time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
diff --git a/lib/uuid/uuid_unparse.3.in b/lib/uuid/uuid_unparse.3.in
index 7099ed2..80aa9a8 100644
--- a/lib/uuid/uuid_unparse.3.in
+++ b/lib/uuid/uuid_unparse.3.in
@@ -13,6 +13,8 @@
 .B #include <uuid/uuid.h>
 .sp
 .BI "void uuid_unparse(uuid_t " uu ", char *" out );
+.BI "void uuid_unparse_upper(uuid_t " uu ", char *" out );
+.BI "void uuid_unparse_lower(uuid_t " uu ", char *" out );
 .fi
 .SH DESCRIPTION
 The
@@ -22,9 +24,18 @@
 from the internal binary format into a 36\-byte string (plus tailing '\\0')
 of the form 1b4e28ba\-2fa1\-11d2\-883f\-b9a76 and stores this value in the
 character string pointed to by
-.IR out .
-.SH "CONFORMING TO"
-OSF DCE 1.1
+.IR out .  
+The case of the hex digits returned by 
+.B uuid_unparse
+may be upper or lower case, and is
+dependent on the system-dependent local default.  
+.PP
+If the case of the
+hex digits is important then the functions
+.B uuid_unparse_upper
+and 
+.B uuid_unparse_lower
+may be used.
 .SH AUTHOR
 .B uuid_unparse
 was written by Theodore Y. Ts'o for the ext2 filesystem utilties.