upgraded to the latest NetBSD version
[unix-history] / usr / src / usr.bin / make / lst.lib / lstForEach.c
CommitLineData
bb2109e7 1/*
4f703748
KB
2 * Copyright (c) 1988, 1989, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
c65fedcf 4 *
bb2109e7
KB
5 * This code is derived from software contributed to Berkeley by
6 * Adam de Boor.
c65fedcf 7 *
f15db449 8 * %sccs.include.redist.c%
c65fedcf 9 */
bb2109e7 10
c65fedcf 11#ifndef lint
bfdbffbb 12static char sccsid[] = "@(#)lstForEach.c 8.2 (Berkeley) %G%";
bb2109e7
KB
13#endif /* not lint */
14
15/*-
16 * LstForeach.c --
17 * Perform a given function on all elements of a list.
18 */
c65fedcf
KB
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*/
38void
39Lst_ForEach (l, proc, d)
40 Lst l;
bfdbffbb 41 register int (*proc) __P((ClientData, ClientData));
c65fedcf
KB
42 register ClientData d;
43{
44 Lst_ForEachFrom(l, Lst_First(l), proc, d);
45}
46