/* pathalias -- by steve bellovin, as told to peter honeyman */
static char *sccsid
= "@(#)main.c 8.1 (down!honey) 86/01/19";
#define MAIN /* for sccsid in header files */
#define USAGE "usage: %s [-vci] [-l localname] [-d deadlink] [-t tracelink] [-g file] [-s file]\n"
(void) allocation(); /* initialize data space monitoring */
Cfile
= "[deadlinks]"; /* for tracing dead links */
while ((c
= getopt(argc
, argv
, "cd:g:il:s:t:v")) != EOF
)
case 'c': /* print cost info */
case 'd': /* dead host or link */
case 'g': /* graph output file */
case 'i': /* ignore case */
case 'l': /* local name */
case 's': /* show shortest path tree */
case 't': /* trace this link */
if (tracelink(optarg
) < 0) {
fprintf(stderr
, "%s: can trace only %d links\n", ProgName
, NTRACE
);
case 'v': /* verbose stderr, mixed blessing */
fprintf(stderr
, USAGE
, ProgName
);
argv
+= optind
; /* kludge for yywrap() */
freopen("/dev/null", "r", stdin
);
fprintf(stderr
, "%s: using \"%s\" for local name\n",
Home
= addnode(locname
); /* add home node */
Home
->n_cost
= 0; /* doesn't cost to get here */
yyparse(); /* read in link info */
vprintf(stderr
, "%d vertices, %d edges\n", Ncount
, Lcount
);
vprintf(stderr
, "allocation is %ldk after parsing\n", allocation());
Cfile
= "[backlinks]"; /* for tracing back links */
mapit(); /* compute shortest path tree */
vprintf(stderr
, "allocation is %ldk after mapping\n", allocation());
printit(); /* traverse tree and print paths */
vprintf(stderr
, "allocation is %ldk after printing\n", allocation());
fprintf(stderr
, "%s: cannot recover!\n", ProgName
);