140412Sbostic /* 262087Sbostic * Copyright (c) 1988, 1989, 1990, 1993 362087Sbostic * The Regents of the University of California. All rights reserved. 440411Sbostic * 540412Sbostic * This code is derived from software contributed to Berkeley by 640412Sbostic * Adam de Boor. 740411Sbostic * 842741Sbostic * %sccs.include.redist.c% 940411Sbostic */ 1040412Sbostic 1140411Sbostic #ifndef lint 12*69094Schristos static char sccsid[] = "@(#)lstMember.c 8.2 (Berkeley) 04/28/95"; 1340412Sbostic #endif /* not lint */ 1440411Sbostic 1540412Sbostic /*- 1640412Sbostic * lstMember.c -- 1740412Sbostic * See if a given datum is on a given list. 1840412Sbostic */ 1940412Sbostic 2040411Sbostic #include "lstInt.h" 2140411Sbostic 2240411Sbostic LstNode Lst_Member(l,d)2340411SbosticLst_Member (l, d) 2440411Sbostic Lst l; 2540411Sbostic ClientData d; 2640411Sbostic { 2740411Sbostic List list = (List) l; 2840411Sbostic register ListNode lNode; 2940411Sbostic 3040411Sbostic lNode = list->firstPtr; 3140411Sbostic if (lNode == NilListNode) { 3240411Sbostic return NILLNODE; 3340411Sbostic } 3440411Sbostic 3540411Sbostic do { 3640411Sbostic if (lNode->datum == d) { 3740411Sbostic return (LstNode)lNode; 3840411Sbostic } 3940411Sbostic lNode = lNode->nextPtr; 4040411Sbostic } while (lNode != NilListNode && lNode != list->firstPtr); 4140411Sbostic 4240411Sbostic return NILLNODE; 4340411Sbostic } 44