ChangeLog, uuid_compare.3.in, compare.c:
  compare.c (uuid_compare): Change sense of uuid_compare so that its
  	return values match that of memcpy and the uuid_compare() found in
  	Paul Leach's internet-draft.

diff --git a/lib/uuid/ChangeLog b/lib/uuid/ChangeLog
index 69d0050..c38761c 100644
--- a/lib/uuid/ChangeLog
+++ b/lib/uuid/ChangeLog
@@ -1,3 +1,9 @@
+1999-05-03    <tytso@rsts-11.mit.edu>
+
+	* compare.c (uuid_compare): Change sense of uuid_compare so that
+		its return values match that of memcpy and the
+		uuid_compare() found in Paul Leach's internet-draft.
+
 1999-03-11  Andreas Dilger <adilger@enel.ucalgary.ca>
 
 	* Created man pages for libuuid functions.
diff --git a/lib/uuid/compare.c b/lib/uuid/compare.c
index 7bca4fa..c1182fe 100644
--- a/lib/uuid/compare.c
+++ b/lib/uuid/compare.c
@@ -13,14 +13,19 @@
 
 #include "uuidP.h"
 
+#define UUCMP(u1,u2) if (u1 != u2) return((u1 < u2) ? -1 : 1);
+
 int uuid_compare(uuid_t uu1, uuid_t uu2)
 {
-	unsigned char 	*cp1, *cp2;
-	int		i;
+	struct uuid	uuid1, uuid2;
 
-	for (i=0, cp1 = uu1, cp2 = uu2; i < 16; i++)
-		if (*cp1++ != *cp2++)
-			return 0;
-	return 1;
+	uuid_unpack(uu1, &uuid1);
+	uuid_unpack(uu2, &uuid2);
+
+	UUCMP(uuid1.time_low, uuid2.time_low);
+	UUCMP(uuid1.time_mid, uuid2.time_mid);
+	UUCMP(uuid1.time_hi_and_version, uuid2.time_hi_and_version);
+	UUCMP(uuid1.clock_seq, uuid2.clock_seq);
+	return memcmp(uuid1.node, uuid2.node, 6);
 }
 
diff --git a/lib/uuid/uuid_compare.3.in b/lib/uuid/uuid_compare.3.in
index 3dab071..de56e42 100644
--- a/lib/uuid/uuid_compare.3.in
+++ b/lib/uuid/uuid_compare.3.in
@@ -21,7 +21,11 @@
 .IR uu1 " and " uu2
 to each other.
 .SH RETURN VALUE
-Returns 1 if the two UUIDs are the same and 0 otherwise.
+Returns an integer less than, equal to, or greater than zero if 
+.I uu1
+is found,  respectively, to be lexigraphically less than, equal, or 
+greater than 
+.IR uu2 .
 .SH AUTHOR
 .B uuid_compare
 was written by Theodore Y. Ts'o for the ext2 filesystem utilties.