1*35973Sbostic #include <stdio.h>
2*35973Sbostic
3*35973Sbostic #ifndef CINDEXFILE
4*35973Sbostic #define CINDEXFILE "/usr/games/lib/dunlib/dindx.dat"
5*35973Sbostic #endif
6*35973Sbostic
main(numargs,argptr)7*35973Sbostic main(numargs, argptr)
8*35973Sbostic
9*35973Sbostic int numargs;
10*35973Sbostic char *argptr[];
11*35973Sbostic {
12*35973Sbostic int chr;
13*35973Sbostic FILE *fpin;
14*35973Sbostic
15*35973Sbostic
16*35973Sbostic fprintf(stderr,"Yawn... \n");
17*35973Sbostic
18*35973Sbostic /* open init file */
19*35973Sbostic fpin = fopen(CINDEXFILE, "r");
20*35973Sbostic if (fpin == NULL) {
21*35973Sbostic fclose(fpin);
22*35973Sbostic fprintf(stderr,"Init file missing.\n");
23*35973Sbostic exit(0);
24*35973Sbostic }
25*35973Sbostic
26*35973Sbostic /* transfer init file into the pipe */
27*35973Sbostic
28*35973Sbostic while ((chr = getc(fpin)) != EOF)
29*35973Sbostic putchar((char)chr);
30*35973Sbostic
31*35973Sbostic fclose(fpin);
32*35973Sbostic
33*35973Sbostic /* check for restore file argument */
34*35973Sbostic
35*35973Sbostic if(numargs > 1){
36*35973Sbostic fpin = fopen(*++argptr,"r");
37*35973Sbostic if( fpin == NULL)
38*35973Sbostic fprintf(stderr,"Restore file missing.\n");
39*35973Sbostic
40*35973Sbostic else {
41*35973Sbostic putchar('R');
42*35973Sbostic while((chr = getc(fpin)) != EOF)
43*35973Sbostic putchar((char)chr);
44*35973Sbostic fprintf(stderr,"Now, where were we...\n");
45*35973Sbostic fclose(fpin);
46*35973Sbostic }
47*35973Sbostic }
48*35973Sbostic
49*35973Sbostic fprintf(stderr,"Oh hello .. \n");
50*35973Sbostic
51*35973Sbostic /* send end of init data flag */
52*35973Sbostic
53*35973Sbostic putchar('?');
54*35973Sbostic fflush(stdout);
55*35973Sbostic
56*35973Sbostic /* send lines of standard input to pipe */
57*35973Sbostic
58*35973Sbostic while ((chr = getchar()) != EOF){
59*35973Sbostic putchar(chr);
60*35973Sbostic if (chr == '\n')
61*35973Sbostic fflush(stdout);
62*35973Sbostic }
63*35973Sbostic
64*35973Sbostic /* end the process */
65*35973Sbostic fprintf(stderr,"Goodnight .. \n");
66*35973Sbostic }
67