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