struct immigrationDbEntry {
	char		filesysName[128];
	unsigned long	extentNo;
	unsigned long	initialTime;
	unsigned long	systemNo;
	unsigned long	packNo;
	char		packType;
	char		filler[3];
	};

main(argc, argv)
int	argc;
char	*argv[];
{
register int		ifd, ofd, i;
char			packed[128 + 2 + 4 + 2 + 2 + 1 + /* filler */ 1];
struct immigrationDbEntry	unpacked;
register char		*from, *to;

if (argc != 3) {
	printf("Usage: %s input_file output_file\n", argv[0]);
	printf("       Use krd to get the input file and kwr to install the output file.\n");
	exit(1);
	}
if ((ifd = open(argv[1], 0)) < 0) {
	perror(argv[1]);
	exit(2);
	}
if ((ofd = creat(argv[2], 0666)) < 0) {
	perror(argv[2]);
	(void)close(ifd);
	exit(3);
	}
while (read(ifd, packed, sizeof packed) == sizeof packed) {
	from = (char *)&packed[0];
	to = (char *)&unpacked;
	for (i = 0; i < 128; i++)
		*to++ = *from++;
	*to++ = *from++; *to++ = *from++; *to++ = '\0'; *to++ = '\0';
	for (i = 0; i < 4; i++)
		*to++ = *from++;
	*to++ = *from++; *to++ = *from++; *to++ = '\0'; *to++ = '\0';
	*to++ = *from++; *to++ = *from++; *to++ = '\0'; *to++ = '\0';
	*to++ = *from++; *to++ = '\0'; *to++ = '\0'; *to++ = '\0';
	printf("name        : %s\n", unpacked.filesysName);
	printf("extent #    : %lu\n", unpacked.extentNo);
	printf("initial time: %lu\n", unpacked.initialTime);
	printf("pack #      : %lu\n", unpacked.packNo);
	printf("pack type   : %d\n\n", unpacked.packType);
	(void)write(ofd, (char *)&unpacked, sizeof unpacked);
	}
(void)close(ifd);
(void)close(ofd);
}
