xref: /csrg-svn/contrib/dungeon/cinit.c (revision 35973)
1*35973Sbostic #include <stdio.h>
2*35973Sbostic 
3*35973Sbostic 
4*35973Sbostic /*	read one integer from the open file */
intrd_(valptr)5*35973Sbostic intrd_(valptr)
6*35973Sbostic 
7*35973Sbostic int *valptr;
8*35973Sbostic {
9*35973Sbostic 	scanf("%d",valptr);
10*35973Sbostic 	while((getchar() != '\n'));
11*35973Sbostic 	return;
12*35973Sbostic }
13*35973Sbostic 
14*35973Sbostic /*	read an array from the open file */
aryrd_(cntptr,aryptr)15*35973Sbostic aryrd_(cntptr,aryptr)
16*35973Sbostic 
17*35973Sbostic int *cntptr,*aryptr[];
18*35973Sbostic {
19*35973Sbostic 	int i;
20*35973Sbostic 
21*35973Sbostic 	for(i = *cntptr; i > 0;--i,++aryptr)
22*35973Sbostic 		scanf("%d",aryptr);
23*35973Sbostic 	while((getchar() != '\n'));
24*35973Sbostic 	return;
25*35973Sbostic }
26*35973Sbostic 
27*35973Sbostic /* get a logical value */
logrd_(ptr)28*35973Sbostic logrd_(ptr)
29*35973Sbostic int *ptr;
30*35973Sbostic {
31*35973Sbostic static char byte;
32*35973Sbostic 
33*35973Sbostic 	*ptr = 0;
34*35973Sbostic 	while((byte = getchar()) != '\n'){
35*35973Sbostic 		if ((byte == 'T') || (byte == 't'))
36*35973Sbostic 			*ptr = 1;
37*35973Sbostic 	}
38*35973Sbostic 	return;
39*35973Sbostic }
40*35973Sbostic 
41*35973Sbostic 
42*35973Sbostic /* wait for end of init flag */
initnd_()43*35973Sbostic initnd_()
44*35973Sbostic {
45*35973Sbostic 	static int chr;
46*35973Sbostic 
47*35973Sbostic 	while ((chr = getchar()) != '?'){	/* wait for end flag */
48*35973Sbostic 		if (chr == 'R')		/* check for restore flag */
49*35973Sbostic 			rstrgm_();	/* call restore routine  */
50*35973Sbostic 	}
51*35973Sbostic 	return;
52*35973Sbostic }
53*35973Sbostic 
54*35973Sbostic /*	write an array to the open pipe */
arywt_(cntptr,aryptr)55*35973Sbostic arywt_(cntptr,aryptr)
56*35973Sbostic 
57*35973Sbostic int *cntptr,*aryptr[];
58*35973Sbostic {
59*35973Sbostic 	static int i;
60*35973Sbostic 
61*35973Sbostic 	for(i = *cntptr; i > 0;--i,++aryptr)
62*35973Sbostic 		printf("%d\n",*aryptr);
63*35973Sbostic 	return;
64*35973Sbostic }
65*35973Sbostic 
66