/* * Copyright (c) 1988, 1989, 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Adam de Boor. * * %sccs.include.redist.c% */ #ifndef lint static char sccsid[] = "@(#)lstLast.c 8.2 (Berkeley) 04/28/95"; #endif /* not lint */ /*- * LstLast.c -- * Return the last element of a list */ #include "lstInt.h" /*- *----------------------------------------------------------------------- * Lst_Last -- * Return the last node on the list l. * * Results: * The requested node or NILLNODE if the list is empty. * * Side Effects: * None. * *----------------------------------------------------------------------- */ LstNode Lst_Last (l) Lst l; { if (!LstValid(l) || LstIsEmpty (l)) { return (NILLNODE); } else { return ((LstNode)((List)l)->lastPtr); } }