posixdir.h revision 58310
121308Sache/* posixdir.h -- Posix directory reading includes and defines. */
221308Sache
321308Sache/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
421308Sache
521308Sache   This file is part of GNU Bash, the Bourne Again SHell.
621308Sache
721308Sache   Bash is free software; you can redistribute it and/or modify it
821308Sache   under the terms of the GNU General Public License as published by
958310Sache   the Free Software Foundation; either version 2, or (at your option)
1021308Sache   any later version.
1121308Sache
1221308Sache   Bash is distributed in the hope that it will be useful, but WITHOUT
1321308Sache   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1421308Sache   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
1521308Sache   License for more details.
1621308Sache
1721308Sache   You should have received a copy of the GNU General Public License
1821308Sache   along with Bash; see the file COPYING.  If not, write to the Free
1958310Sache   Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
2021308Sache
2121308Sache/* This file should be included instead of <dirent.h> or <sys/dir.h>. */
2221308Sache
2321308Sache#if !defined (_POSIXDIR_H_)
2421308Sache#define _POSIXDIR_H_
2521308Sache
2621308Sache#if defined (HAVE_DIRENT_H)
2721308Sache#  include <dirent.h>
2821308Sache#  define D_NAMLEN(d)   (strlen ((d)->d_name))
2921308Sache#else
3021308Sache#  if defined (HAVE_SYS_NDIR_H)
3121308Sache#    include <sys/ndir.h>
3221308Sache#  endif
3321308Sache#  if defined (HAVE_SYS_DIR_H)
3421308Sache#    include <sys/dir.h>
3521308Sache#  endif
3621308Sache#  if defined (HAVE_NDIR_H)
3721308Sache#    include <ndir.h>
3821308Sache#  endif
3921308Sache#  if !defined (dirent)
4021308Sache#    define dirent direct
4121308Sache#  endif /* !dirent */
4221308Sache#  define D_NAMLEN(d)   ((d)->d_namlen)
4321308Sache#endif /* !HAVE_DIRENT_H */
4421308Sache
4526497Sache#if defined (STRUCT_DIRENT_HAS_D_INO) && !defined (STRUCT_DIRENT_HAS_D_FILENO)
4621308Sache#  define d_fileno d_ino
4721308Sache#endif
4821308Sache
4921308Sache#endif /* !_POSIXDIR_H_ */
50