xref: /original-bsd/usr.bin/make/lst.lib/lstInit.c (revision 0842ddeb)
1 /*
2  * Copyright (c) 1988, 1989, 1990, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Adam de Boor.
7  *
8  * %sccs.include.redist.c%
9  */
10 
11 #ifndef lint
12 static char sccsid[] = "@(#)lstInit.c	8.2 (Berkeley) 04/28/95";
13 #endif /* not lint */
14 
15 /*-
16  * init.c --
17  *	Initialize a new linked list.
18  */
19 
20 #include	"lstInt.h"
21 
22 /*-
23  *-----------------------------------------------------------------------
24  * Lst_Init --
25  *	Create and initialize a new list.
26  *
27  * Results:
28  *	The created list.
29  *
30  * Side Effects:
31  *	A list is created, what else?
32  *
33  *-----------------------------------------------------------------------
34  */
35 Lst
36 Lst_Init(circ)
37     Boolean		circ;	/* TRUE if the list should be made circular */
38 {
39     register List	nList;
40 
41     PAlloc (nList, List);
42 
43     nList->firstPtr = NilListNode;
44     nList->lastPtr = NilListNode;
45     nList->isOpen = FALSE;
46     nList->isCirc = circ;
47     nList->atEnd = Unknown;
48 
49     return ((Lst)nList);
50 }
51