Commit | Line | Data |
---|---|---|
bb2109e7 | 1 | /* |
4f703748 KB |
2 | * Copyright (c) 1988, 1989, 1990, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
c65fedcf | 4 | * |
bb2109e7 KB |
5 | * This code is derived from software contributed to Berkeley by |
6 | * Adam de Boor. | |
c65fedcf | 7 | * |
f15db449 | 8 | * %sccs.include.redist.c% |
c65fedcf | 9 | */ |
bb2109e7 | 10 | |
c65fedcf | 11 | #ifndef lint |
bfdbffbb | 12 | static char sccsid[] = "@(#)lstFirst.c 8.2 (Berkeley) %G%"; |
bb2109e7 KB |
13 | #endif /* not lint */ |
14 | ||
15 | /*- | |
16 | * LstFirst.c -- | |
17 | * Return the first node of a list | |
18 | */ | |
c65fedcf KB |
19 | |
20 | #include "lstInt.h" | |
21 | ||
22 | /*- | |
23 | *----------------------------------------------------------------------- | |
24 | * Lst_First -- | |
25 | * Return the first node on the given list. | |
26 | * | |
27 | * Results: | |
28 | * The first node or NILLNODE if the list is empty. | |
29 | * | |
30 | * Side Effects: | |
31 | * None. | |
32 | * | |
33 | *----------------------------------------------------------------------- | |
34 | */ | |
35 | LstNode | |
36 | Lst_First (l) | |
37 | Lst l; | |
38 | { | |
39 | if (!LstValid (l) || LstIsEmpty (l)) { | |
40 | return (NILLNODE); | |
41 | } else { | |
42 | return ((LstNode)((List)l)->firstPtr); | |
43 | } | |
44 | } | |
45 |