1*40411Sbostic /*- 2*40411Sbostic * LstCur.c -- 3*40411Sbostic * Return the current node in the list. 4*40411Sbostic * The sequential functions access the list in a slightly different way. 5*40411Sbostic * CurPtr points to their idea of the current node in the list and they 6*40411Sbostic * access the list based on it. Because the list is circular, Lst_Next 7*40411Sbostic * and Lst_Prev will go around the list forever. Lst_IsAtEnd must be 8*40411Sbostic * used to determine when to stop. 9*40411Sbostic * 10*40411Sbostic * Copyright (c) 1988 by University of California Regents 11*40411Sbostic * 12*40411Sbostic * Permission to use, copy, modify, and distribute this 13*40411Sbostic * software and its documentation for any purpose and without 14*40411Sbostic * fee is hereby granted, provided that the above copyright 15*40411Sbostic * notice appears in all copies. Neither the University of California nor 16*40411Sbostic * Adam de Boor makes any representations about the suitability of this 17*40411Sbostic * software for any purpose. It is provided "as is" without 18*40411Sbostic * express or implied warranty. 19*40411Sbostic */ 20*40411Sbostic #ifndef lint 21*40411Sbostic static char *rcsid = 22*40411Sbostic "$Id: lstCur.c,v 1.4 88/11/17 20:52:03 adam Exp $ SPRITE (Berkeley)"; 23*40411Sbostic #endif lint 24*40411Sbostic 25*40411Sbostic #include "lstInt.h" 26*40411Sbostic 27*40411Sbostic /*- 28*40411Sbostic *----------------------------------------------------------------------- 29*40411Sbostic * Lst_Cur -- 30*40411Sbostic * Return the current node if the list is open for sequential 31*40411Sbostic * access. 32*40411Sbostic * 33*40411Sbostic * Results: 34*40411Sbostic * The current node or NILLNODE if the list isn't open.. 35*40411Sbostic * 36*40411Sbostic * Side Effects: 37*40411Sbostic * None. 38*40411Sbostic * 39*40411Sbostic *----------------------------------------------------------------------- 40*40411Sbostic */ 41*40411Sbostic LstNode 42*40411Sbostic Lst_Cur (l) 43*40411Sbostic Lst l; 44*40411Sbostic { 45*40411Sbostic register List list = (List)l; 46*40411Sbostic 47*40411Sbostic if ((LstValid(l) == FALSE) || 48*40411Sbostic (list->isOpen == FALSE)) { 49*40411Sbostic return (NILLNODE); 50*40411Sbostic } else { 51*40411Sbostic return ((LstNode)list->curPtr); 52*40411Sbostic } 53*40411Sbostic } 54*40411Sbostic 55