This is p-dirent.h in view mode; [Download] [Up]
/*+++*
* RCS $Id: p-dirent.h,v 1.2 1993/02/02 21:00:42 gerben Exp $
* title: p-dirent.h
* abstract: portable Posix-compliant <dirent.h>.
* author: T.R.Hageman, Groningen, The Netherlands
* created: October 1992
* modified: (see RCS Log at end)
* copyleft:
*
* Copyright (C) 1992 Tom R. Hageman.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* description:
*
* This is a Posix-compatible version of <dirent.h> for both Posix
* and non-Posix systems.
*
* Notes:
* o Posix guarantees the existence of `d_name' field in `struct dirent',
* but nothing more. The macro DIRNAMLEN(dirent) is defined to
* provide a system-independent means of getting the length of the
* directory name, but only iff not __STRICT_POSIX__.
*
* o Some systems use `int' as the return type of closedir() instead of
* `void'.
*
* BUGS:
* - only systems that already support {open,read,close}dir() in any way
* are supported.
*---*/
#ifndef _P_DIRENT_H_
#define _P_DIRENT_H_ 0x100
#ifndef _PORTDEFS_H_
# include "portdefs.h"
#endif
#if __STRICT_ANSI__
#error "You shouldn't use this header in strict ANSI C code"
#endif
#ifndef _SYS_TYPES_H_
# include <sys/types.h> /* required by Posix. */
# define _SYS_TYPES_H_
#endif
/*
* Note: the appropriate _I_<header> should only be defined if the header
* contains prototypes for {open,read,close}dir() and a definition of the
* DIR type.
*/
#if _I_DIRENT
# include <dirent.h>
# if !__STRICT_POSIX__
# define DIRNAMLEN(entry) (strlen((entry)->d_name))
# endif
#else
# define dirent direct
# if !__STRICT_POSIX__
# define DIRNAMLEN(entry) ((entry)->d_namlen)
# endif
# if _I_NDIR
# include <ndir.h>
# else
# if _I_SYS_NDIR
# include <sys/ndir.h>
# else
# if _I_SYS_DIR
# include <sys/dir.h>
# else
#error "dirent not supported"
# endif
# endif
# endif
#endif
#if !(_I_DIRENT || _I_NDIR || _I_SYS_NDIR || _I_SYS_DIR)
#if !__NO_PROTO__
extern DIR *opendir __(( const char *_(dir) ));
extern struct dirent *readdir __(( DIR *_(dp) ));
extern void closedir __(( DIR *_(dp) ));
#endif /* !__NO_PROTO__ */
#endif /* !_I_DIRENT */
#endif /* _P_DIRENT_H_ */
/*======================================================================*
* $Log: p-dirent.h,v $
* Revision 1.2 1993/02/02 21:00:42 gerben
* *** empty log message ***
*
* Revision 1.1 1992/10/31 01:59:55 tom
* Initial revision
*
*======================================================================*/
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.