man page in the right palce
[unix-history] / usr / src / usr.bin / make / lst.lib / lstInit.c
CommitLineData
bb2109e7
KB
1/*
2 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
3 * All rights reserved.
c65fedcf 4 *
bb2109e7
KB
5 * This code is derived from software contributed to Berkeley by
6 * Adam de Boor.
c65fedcf 7 *
bb2109e7
KB
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the University of California, Berkeley. The name of the
14 * University may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
c65fedcf 19 */
bb2109e7 20
c65fedcf 21#ifndef lint
bb2109e7
KB
22static char sccsid[] = "@(#)lstInit.c 5.2 (Berkeley) %G%";
23#endif /* not lint */
24
25/*-
26 * init.c --
27 * Initialize a new linked list.
28 */
c65fedcf
KB
29
30#include "lstInt.h"
31
32/*-
33 *-----------------------------------------------------------------------
34 * Lst_Init --
35 * Create and initialize a new list.
36 *
37 * Results:
38 * The created list.
39 *
40 * Side Effects:
41 * A list is created, what else?
42 *
43 *-----------------------------------------------------------------------
44 */
45Lst
46Lst_Init(circ)
47 Boolean circ; /* TRUE if the list should be made circular */
48{
49 register List nList;
50
51 PAlloc (nList, List);
52
53 nList->firstPtr = NilListNode;
54 nList->lastPtr = NilListNode;
55 nList->isOpen = FALSE;
56 nList->isCirc = circ;
57 nList->atEnd = Unknown;
58
59 return ((Lst)nList);
60}
61
62Malloc(nbytes)
63{
64#ifdef DEBUG
65 printf("malloc: %d\n", nbytes);
66#endif DEBUG
67 return(malloc(nbytes));
68}