1 /*- 2 * LstFirst.c -- 3 * Return the first node of a list 4 * 5 * Copyright (c) 1988 by University of California Regents 6 * 7 * Permission to use, copy, modify, and distribute this 8 * software and its documentation for any purpose and without 9 * fee is hereby granted, provided that the above copyright 10 * notice appears in all copies. Neither the University of California nor 11 * Adam de Boor makes any representations about the suitability of this 12 * software for any purpose. It is provided "as is" without 13 * express or implied warranty. 14 */ 15 #ifndef lint 16 static char *rcsid = 17 "$Id: lstFirst.c,v 1.5 88/11/17 20:52:44 adam Exp $ SPRITE (Berkeley)"; 18 #endif lint 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 46