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