view sbr/closefds.c @ 10:a6481689f99c

*** empty log message ***
author kono
date Wed, 06 Dec 2006 03:17:53 +0900
parents bce86c4163a3
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);
}