view sbr/closefds.c @ 0:bce86c4163a3

Initial revision
author kono
date Mon, 18 Apr 2005 23:46:02 +0900
parents
children 441a2190cfae
line wrap: on
line source

/* closefds.c - close-up fd:s */
#ifndef	lint
static char ident[] = "@(#)$Id$";
#endif	/* lint */

#include "../h/mh.h"
#ifndef	BSD42
#include <stdio.h>
#endif	/* not BSD42 */


void	closefds (i)
register int	i;
{
#if !defined(BSD42) && !defined(linux) && defined(_NFILE)
    int     nbits = _NFILE;
#else	/* BSD42 || linux */
    int     nbits = getdtablesize ();
#endif	/* BSD42 || linux */

    for (; i < nbits; i++)
#ifdef	OVERHEAD
	if (i != fd_def && i != fd_ctx)
#endif	/* OVERHEAD */
	    (void) close (i);
}