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[] = "@(#)lstForEach.c 8.2 (Berkeley) 04/28/95";
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
Lst_ForEach(l,proc,d)3940411Sbostic Lst_ForEach (l, proc, d)
4040411Sbostic Lst l;
41*69094Schristos register int (*proc) __P((ClientData, ClientData));
4240411Sbostic register ClientData d;
4340411Sbostic {
4440411Sbostic Lst_ForEachFrom(l, Lst_First(l), proc, d);
4540411Sbostic }
4640411Sbostic
47