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