Many files:
  * gen_uuid.c (get_random_bytes): Use a while loop when reading from
  	/dev/urandom so that if we get interrupted while reading the right
  	thing happens.
  	(uuid_generate_random): Add new function which uses the new UUID
  	format which uses 122 random bits to form the 128-bit UUID.
  	(uuid_generate): Rename the old uuid_generate to be
  	uuid_generate_time, and create a new uuid_generate function which
  	calls either uuid_generate_random or uuid_genereate_time depending on
  	whether /dev/urandom is present.
  uuid_generate.3.in: Update to reflect changesin uuid_generate and its
  	two new variants.
  tst_uuid.c: Updated to test new uuid_generate functions, and to
  	reflect new semantics of uuid_compare.  Added tests to make sure the
  	UUID type and variant created by UUID generate is correct.
  uuid_time.c (uuid_variant, uuid_type): Added new functions to return
  	the UUID variant and type information.  The debugging program now
  	prints the UUID variant and type, and warns if the unparsed time
  	information is likely to be incorrect.
  uuid_parse.3.in, libuuid.3.in: Miscellaneous text cleanups.
uuidgen.1.in:
  Miscellaneous text cleanups.

diff --git a/lib/uuid/tst_uuid.c b/lib/uuid/tst_uuid.c
index f798470..b9fc5f6 100644
--- a/lib/uuid/tst_uuid.c
+++ b/lib/uuid/tst_uuid.c
@@ -24,22 +24,71 @@
 	unsigned char	*cp;
 	int i;
 	int failed = 0;
+	int type, variant;
 
 	uuid_generate(buf);
 	uuid_unparse(buf, str);
-	printf("UUID string = %s\n", str);
+	printf("UUID generate = %s\n", str);
 	printf("UUID: ");
 	for (i=0, cp = (unsigned char *) &buf; i < 16; i++) {
 		printf("%02x", *cp++);
 	}
 	printf("\n");
+	type = uuid_type(buf); 	variant = uuid_variant(buf);
+	printf("UUID type = %d, UUID variant = %d\n", type, variant);
+	if (variant != UUID_VARIANT_DCE) {
+		printf("Incorrect UUID Variant; was expecting DCE!\n");
+		failed++;
+	}
+	printf("\n");
+
+	uuid_generate_random(buf);
+	uuid_unparse(buf, str);
+	printf("UUID random string = %s\n", str);
+	printf("UUID: ");
+	for (i=0, cp = (unsigned char *) &buf; i < 16; i++) {
+		printf("%02x", *cp++);
+	}
+	printf("\n");
+	type = uuid_type(buf); 	variant = uuid_variant(buf);
+	printf("UUID type = %d, UUID variant = %d\n", type, variant);
+	if (variant != UUID_VARIANT_DCE) {
+		printf("Incorrect UUID Variant; was expecting DCE!\n");
+		failed++;
+	}
+	if (type != 4) {
+		printf("Incorrect UUID type; was expecting "
+		       "4 (random type)!\n");
+		failed++;
+	}
+	printf("\n");
+	
+	uuid_generate_time(buf);
+	uuid_unparse(buf, str);
+	printf("UUID string = %s\n", str);
+	printf("UUID time: ");
+	for (i=0, cp = (unsigned char *) &buf; i < 16; i++) {
+		printf("%02x", *cp++);
+	}
+	printf("\n");
+	type = uuid_type(buf); 	variant = uuid_variant(buf);
+	printf("UUID type = %d, UUID variant = %d\n", type, variant);
+	if (variant != UUID_VARIANT_DCE) {
+		printf("Incorrect UUID Variant; was expecting DCE!\n");
+		failed++;
+	}
+	if (type != 1) {
+		printf("Incorrect UUID type; was expecting "
+		       "1 (time-based type)!\\n");
+		failed++;
+	}
 	tv.tv_sec = 0;
 	tv.tv_usec = 0;
 	time_reg = uuid_time(buf, &tv);
 	printf("UUID time is: (%d, %d): %s\n", tv.tv_sec, tv.tv_usec,
 	       ctime(&time_reg));
 	uuid_parse(str, tst);
-	if (uuid_compare(buf, tst))
+	if (!uuid_compare(buf, tst))
 		printf("UUID parse and compare succeeded.\n");
 	else {
 		printf("UUID parse and compare failed!\n");
@@ -53,7 +102,7 @@
 		failed++;
 	}
 	uuid_copy(buf, tst);
-	if (uuid_compare(buf, tst))
+	if (!uuid_compare(buf, tst))
 		printf("UUID copy and compare succeeded.\n");
 	else {
 		printf("UUID copy and compare failed!\n");