2004-09-13  Dmitry V. Levin  <ldv@altlinux.org>

	* linux/ioctlsort.c (main): Omit duplicate lines
	(with same name and code) from output.
	* linux/ioctlent.sh: Build the list of ioctls defined in
	scsi/sg.h (0x22..), scsi/scsi.h and scsi/scsi_ioctl.h (0x53..),
	as suggested by Peter Jones <pjones@redhat.com>
	* linux/ioctlent.h: Regenerated.
	Fixes RH#129808.
diff --git a/linux/ioctlsort.c b/linux/ioctlsort.c
index fcccf38..f544d84 100644
--- a/linux/ioctlsort.c
+++ b/linux/ioctlsort.c
@@ -43,8 +43,10 @@
 	qsort(ioctls, nioctls, sizeof(ioctls[0]), compare);
 	puts ("\t/* Generated by ioctlsort */");
 	for (i = 0; i < nioctls; i++)
-		printf("\t{\"%s\",\t\"%s\",\t%#lx},\n",
-			ioctls[i].header, ioctls[i].name, ioctls[i].code);
+		if (i == 0 || ioctls[i].code != ioctls[i-1].code ||
+		    strcmp (ioctls[i].name, ioctls[i-1].name))
+			printf("\t{\"%s\",\t\"%s\",\t%#lx},\n",
+				ioctls[i].header, ioctls[i].name, ioctls[i].code);
 
 	return 0;
 }