1 /*- 2 * %sccs.include.proprietary.c% 3 */ 4 5 #ifndef lint 6 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 06/06/93"; 7 #endif /* not lint */ 8 9 #include <signal.h> 10 #include <stdio.h> 11 #include "1.defs.h" 12 #include "def.h" 13 14 15 char (*input)(), (*unput)(); 16 FILE *outfd = stdout; 17 18 19 20 main(argc,argv) 21 int argc; 22 char *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 74 dexit() 75 { 76 exit(1); 77 } 78