2 * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
10 * By using this file, you agree to the terms and conditions set
11 * forth in the LICENSE file which can be found at the top level of
12 * the sendmail distribution.
16 SM_RCSID("@(#)$Id: fwalk.c,v 1.21 2001/09/11 04:04:48 gshapiro Exp $")
23 ** SM_FWALK -- apply a function to all found-open file pointers
26 ** function -- a function vector to be applied
27 ** timeout -- time to complete actions (milliseconds)
30 ** The (binary) OR'd result of each function call
34 sm_fwalk(function
, timeout
)
35 int (*function
) __P((SM_FILE_T
*, int *));
38 register SM_FILE_T
*fp
;
40 register struct sm_glue
*g
;
44 for (g
= &smglue
; g
!= NULL
; g
= g
->gl_next
)
46 for (fp
= g
->gl_iobs
, n
= g
->gl_niobs
; --n
>= 0; fp
++)
50 if (*timeout
== SM_TIME_DEFAULT
)
51 fptimeout
= fp
->f_timeout
;
54 if (fptimeout
== SM_TIME_IMMEDIATE
)
55 continue; /* skip it */
56 ret
|= (*function
)(fp
, &fptimeout
);