xref: /csrg-svn/contrib/dungeon/decode.c (revision 35973)
1*35973Sbostic /*
2*35973Sbostic  * Decode dtext.dat file into readable ASCII.
3*35973Sbostic  * John Gilmore (hoptoad!gnu), December 1986
4*35973Sbostic  */
5*35973Sbostic #include <stdio.h>
6*35973Sbostic #define STRLEN 74
7*35973Sbostic char string[STRLEN+1];
8*35973Sbostic int recno = 0;
9*35973Sbostic 
main()10*35973Sbostic main() {
11*35973Sbostic 	unsigned char byte, byte2;
12*35973Sbostic 	int i;
13*35973Sbostic 
14*35973Sbostic 	while (1) {
15*35973Sbostic 		recno++;
16*35973Sbostic 		byte = getchar();
17*35973Sbostic 		byte2 = getchar();
18*35973Sbostic 		if (1 != fread (string, STRLEN, 1, stdin)) exit(0);
19*35973Sbostic 		for (i = 1; i <= STRLEN; i++)
20*35973Sbostic 			string[i-1] ^= (recno&31)+i;
21*35973Sbostic 		printf("%2x%02x %s\n",
22*35973Sbostic 			byte2, byte, string);
23*35973Sbostic 	}
24*35973Sbostic }
25*35973Sbostic 
26