Research V7 development
[unix-history] / usr / src / cmd / struct / main.c
CommitLineData
2a70a0a1
BB
1#include <signal.h>
2#include <stdio.h>
3#include "1.defs.h"
4#include "def.h"
5
6
7char (*input)(), (*unput)();
8FILE *outfd = stdout;
9
10
11
12main(argc,argv)
13int argc;
14char *argv[];
15 {
16 int anyoutput;
17 int dexit();
18 char *getargs();
19 char input1(), unput1(), input2(), unput2();
20 anyoutput = FALSE;
21 getargs(argc,argv);
22 if (debug == 2) debfd = stderr;
23 else if (debug)
24 debfd = fopen("debug1","w");
25
26 if (signal(SIGINT, SIG_IGN) !=SIG_IGN)
27 signal(SIGINT,dexit);
28 prog_init();
29
30 for (;;)
31 {
32 ++routnum;
33 routerr = 0;
34
35 input = input1;
36 unput = unput1;
37 if (!mkgraph()) break;
38 if (debug) prgraph();
39 if (routerr) continue;
40
41 if (progress)fprintf(stderr,"build:\n");
42 build();
43 if (debug) prtree();
44 if (routerr) continue;
45
46 if (progress)fprintf(stderr,"structure:\n");
47 structure();
48 if (debug) prtree();
49 if (routerr) continue;
50 input = input2;
51 unput = unput2;
52
53 if (progress)fprintf(stderr,"output:\n");
54 output();
55 if (routerr) continue;
56 anyoutput = TRUE;
57 freegraf();
58 }
59 if (anyoutput)
60 exit(0);
61 else
62 exit(1);
63 }
64
65
66dexit()
67 {
68 exit(1);
69 }