1*40411Sbostic /*- 2*40411Sbostic * LstForeach.c -- 3*40411Sbostic * Perform a given function on all elements of a list. 4*40411Sbostic * 5*40411Sbostic * Copyright (c) 1988 by University of California Regents 6*40411Sbostic * 7*40411Sbostic * Permission to use, copy, modify, and distribute this 8*40411Sbostic * software and its documentation for any purpose and without 9*40411Sbostic * fee is hereby granted, provided that the above copyright 10*40411Sbostic * notice appears in all copies. Neither the University of California nor 11*40411Sbostic * Adam de Boor makes any representations about the suitability of this 12*40411Sbostic * software for any purpose. It is provided "as is" without 13*40411Sbostic * express or implied warranty. 14*40411Sbostic */ 15*40411Sbostic #ifndef lint 16*40411Sbostic static char *rcsid = 17*40411Sbostic "$Id: lstForEach.c,v 1.8 89/11/14 16:59:42 adam Exp $ SPRITE (Berkeley)"; 18*40411Sbostic #endif lint 19*40411Sbostic 20*40411Sbostic #include "lstInt.h" 21*40411Sbostic 22*40411Sbostic /*- 23*40411Sbostic *----------------------------------------------------------------------- 24*40411Sbostic * Lst_ForEach -- 25*40411Sbostic * Apply the given function to each element of the given list. The 26*40411Sbostic * function should return 0 if Lst_ForEach should continue and non- 27*40411Sbostic * zero if it should abort. 28*40411Sbostic * 29*40411Sbostic * Results: 30*40411Sbostic * None. 31*40411Sbostic * 32*40411Sbostic * Side Effects: 33*40411Sbostic * Only those created by the passed-in function. 34*40411Sbostic * 35*40411Sbostic *----------------------------------------------------------------------- 36*40411Sbostic */ 37*40411Sbostic /*VARARGS2*/ 38*40411Sbostic void 39*40411Sbostic Lst_ForEach (l, proc, d) 40*40411Sbostic Lst l; 41*40411Sbostic register int (*proc)(); 42*40411Sbostic register ClientData d; 43*40411Sbostic { 44*40411Sbostic Lst_ForEachFrom(l, Lst_First(l), proc, d); 45*40411Sbostic } 46*40411Sbostic 47