140412Sbostic /* 240412Sbostic * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 340412Sbostic * All rights reserved. 440411Sbostic * 540412Sbostic * This code is derived from software contributed to Berkeley by 640412Sbostic * Adam de Boor. 740411Sbostic * 8*42741Sbostic * %sccs.include.redist.c% 940411Sbostic */ 1040412Sbostic 1140411Sbostic #ifndef lint 12*42741Sbostic static char sccsid[] = "@(#)lstForEach.c 5.3 (Berkeley) 06/01/90"; 1340412Sbostic #endif /* not lint */ 1440411Sbostic 1540412Sbostic /*- 1640412Sbostic * LstForeach.c -- 1740412Sbostic * Perform a given function on all elements of a list. 1840412Sbostic */ 1940412Sbostic 2040411Sbostic #include "lstInt.h" 2140411Sbostic 2240411Sbostic /*- 2340411Sbostic *----------------------------------------------------------------------- 2440411Sbostic * Lst_ForEach -- 2540411Sbostic * Apply the given function to each element of the given list. The 2640411Sbostic * function should return 0 if Lst_ForEach should continue and non- 2740411Sbostic * zero if it should abort. 2840411Sbostic * 2940411Sbostic * Results: 3040411Sbostic * None. 3140411Sbostic * 3240411Sbostic * Side Effects: 3340411Sbostic * Only those created by the passed-in function. 3440411Sbostic * 3540411Sbostic *----------------------------------------------------------------------- 3640411Sbostic */ 3740411Sbostic /*VARARGS2*/ 3840411Sbostic void 3940411Sbostic Lst_ForEach (l, proc, d) 4040411Sbostic Lst l; 4140411Sbostic register int (*proc)(); 4240411Sbostic register ClientData d; 4340411Sbostic { 4440411Sbostic Lst_ForEachFrom(l, Lst_First(l), proc, d); 4540411Sbostic } 4640411Sbostic 47