BSD 4_1c_2 release
[unix-history] / usr / src / usr.bin / struct / 1.finish.c
CommitLineData
d03accc5 1#ifndef lint
e804469b 2static char sccsid[] = "@(#)1.finish.c 4.1 (Berkeley) 2/11/83";
d03accc5
RH
3#endif not lint
4
5#include <stdio.h>
6#include "def.h"
7#include "1.incl.h"
8
9fingraph()
10 {
11 /* if any entry statements, add a DUMVX with arcs to all entry statements */
12 if (ENTLST)
13 {
14 ARC(START,0) = addum(ARC(START,0),ENTLST);
15 freelst(ENTLST);
16 }
17 /* if any FMTVX, add a DUMVX with arcs to all FMTVX's */
18 if (FMTLST)
19 {
20 ARC(START,0) = addum(ARC(START,0),FMTLST);
21 freelst(FMTLST);
22 }
23 }
24
25addum(v,lst)
26VERT v;
27struct list *lst;
28 {
29 VERT new;
30 int count,i;
31 struct list *ls;
32 count = lslen(lst); /* length of lst */
33 new = create(DUMVX,1+count);
34 ARC(new,0) = v;
35 for (i = count, ls = lst; i >= 1; --i, ls = ls->nxtlist)
36 {
37 ASSERT(ls,addum);
38 ARC(new,i) = ls->elt;
39 }
40 ASSERT(!ls, addum);
41 return(new);
42 }