1 /*-
2  * lstMember.c --
3  *	See if a given datum is on a given list.
4  *
5  * Copyright (c) 1988 by the Regents of the University of California
6  * Copyright (c) 1988 by Adam de Boor
7  *
8  * Permission to use, copy, modify, and distribute this
9  * software and its documentation for any purpose and without
10  * fee is hereby granted, provided that the above copyright
11  * notice appears in all copies.  The University of California nor
12  * Adam de Boor makes any representations about the suitability of this
13  * software for any purpose.  It is provided "as is" without
14  * express or implied warranty.
15  *
16  *
17  */
18 #ifndef lint
19 static char *rcsid =
20 "$Id: lstMember.c,v 1.5 88/11/17 20:53:32 adam Exp $ SPRITE (Berkeley)";
21 #endif lint
22 
23 #include    "lstInt.h"
24 
25 LstNode
26 Lst_Member (l, d)
27     Lst	    	  	l;
28     ClientData	  	d;
29 {
30     List    	  	list = (List) l;
31     register ListNode	lNode;
32 
33     lNode = list->firstPtr;
34     if (lNode == NilListNode) {
35 	return NILLNODE;
36     }
37 
38     do {
39 	if (lNode->datum == d) {
40 	    return (LstNode)lNode;
41 	}
42 	lNode = lNode->nextPtr;
43     } while (lNode != NilListNode && lNode != list->firstPtr);
44 
45     return NILLNODE;
46 }
47