1 /* 2 * Copyright (c) 1988, 1989, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Adam de Boor. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11 #ifndef lint 12 static char sccsid[] = "@(#)lstMember.c 8.2 (Berkeley) 04/28/95"; 13 #endif /* not lint */ 14 15 /*- 16 * lstMember.c -- 17 * See if a given datum is on a given list. 18 */ 19 20 #include "lstInt.h" 21 22 LstNode Lst_Member(l,d)23Lst_Member (l, d) 24 Lst l; 25 ClientData d; 26 { 27 List list = (List) l; 28 register ListNode lNode; 29 30 lNode = list->firstPtr; 31 if (lNode == NilListNode) { 32 return NILLNODE; 33 } 34 35 do { 36 if (lNode->datum == d) { 37 return (LstNode)lNode; 38 } 39 lNode = lNode->nextPtr; 40 } while (lNode != NilListNode && lNode != list->firstPtr); 41 42 return NILLNODE; 43 } 44