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