2 * This file has been modified for the cdrkit suite.
4 * The behaviour and appearence of the program code below can differ to a major
5 * extent from the version distributed by the original author(s).
7 * For details, see Changelog file distributed with the cdrkit package. If you
8 * received this file from another source then ask the distributing person for
9 * a log of modifications.
13 /* @(#)dirdefs.h 1.15 04/06/16 Copyright 1987, 1998 J. Schilling */
15 * Copyright (c) 1987, 1998 J. Schilling
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License version 2
20 * as published by the Free Software Foundation.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License along with
28 * this program; see the file COPYING. If not, write to the Free Software
29 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
44 # ifndef _INCL_SYS_STYPES_H
45 # include <sys/stypes.h>
46 # define _INCL_SYS_STYPES_H
48 # ifndef _INCL_SYS_FILEDESC_H
49 # include <sys/filedesc.h>
50 # define _INCL_SYS_FILEDESC_H
53 # define dirent _direct
54 # define DIR_NAMELEN(dirent) strlen((dirent)->d_name)
56 # define FOUND_DIRSIZE
57 typedef struct _dirent {
64 # ifndef _INCL_SYS_TYPES_H
65 # include <sys/types.h>
66 # define _INCL_SYS_TYPES_H
68 # ifndef _INCL_SYS_STAT_H
69 # include <sys/stat.h>
70 # define _INCL_SYS_STAT_H
73 # ifndef _INCL_LIMITS_H
75 # define _INCL_LIMITS_H
78 # ifdef HAVE_SYS_PARAM_H
79 # ifndef _INCL_SYS_PARAM_H
80 # include <sys/param.h>
81 # define _INCL_SYS_PARAM_H
85 # ifdef HAVE_DIRENT_H /* This a POSIX compliant system */
86 # ifndef _INCL_DIRENT_H
88 # define _INCL_DIRENT_H
90 # define DIR_NAMELEN(dirent) strlen((dirent)->d_name)
92 # else /* This is a Pre POSIX system */
94 # define dirent direct
95 # define DIR_NAMELEN(dirent) (dirent)->d_namlen
97 # if defined(HAVE_SYS_DIR_H)
98 # ifndef _INCL_SYS_DIR_H
100 # define _INCL_SYS_DIR_H
105 # if defined(HAVE_NDIR_H) && !defined(_FOUND_DIR_)
106 # ifndef _INCL_NDIR_H
108 # define _INCL_NDIR_H
113 # if defined(HAVE_SYS_NDIR_H) && !defined(_FOUND_DIR_)
114 # ifndef _INCL_SYS_NDIR_H
115 # include <sys/ndir.h>
116 # define _INCL_SYS_NDIR_H
120 # endif /* HAVE_DIRENT_H */
122 # if defined(_FOUND_DIR_)
124 * Don't use defaults here to allow recognition of problems.
127 # define DIRSIZE MAXNAMELEN /* From sys/param.h */
128 # define FOUND_DIRSIZE
131 # define DIRSIZE MAXNAMLEN /* From dirent.h */
132 # define FOUND_DIRSIZE
135 # define DIRSIZE DIRSIZ /* From sys/dir.h */
136 # define FOUND_DIRSIZE
140 # else /* !_FOUND_DIR_ */
143 # define NEED_READDIR
144 # define dirent _direct
145 # define DIR_NAMELEN(dirent) strlen((dirent)->d_name)
147 # endif /* _FOUND_DIR_ */
152 #ifndef FOUND_DIRSIZE
153 #define DIRSIZE 14 /* The old UNIX standard value */
154 #define FOUND_DIRSIZE
157 typedef struct _dirent {
162 #endif /* NEED_DIRENT */
167 typedef struct __dirdesc {
173 unsigned short d_reclen;
174 unsigned short d_namlen;
175 char d_name[DIRSIZE +1];
178 extern DIR *opendir();
180 extern struct dirent *readdir();
182 #endif /* NEED_READDIR */
188 #endif /* _DIRDEFS_H */