428
+ − 1 /*
+ − 2 Copyright (C) 1995 Free Software Foundation, Inc.
+ − 3
+ − 4 This file is part of XEmacs.
+ − 5
+ − 6 XEmacs is free software; you can redistribute it and/or modify it
+ − 7 under the terms of the GNU General Public License as published by the
+ − 8 Free Software Foundation; either version 2, or (at your option) any
+ − 9 later version.
+ − 10
+ − 11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
+ − 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ − 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ − 14 for more details.
+ − 15
+ − 16 You should have received a copy of the GNU General Public License
+ − 17 along with XEmacs; see the file COPYING. If not, write to
+ − 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ − 19 Boston, MA 02111-1307, USA. */
+ − 20
+ − 21 /* Synched up with: Not really in FSF. */
+ − 22
440
+ − 23 #ifndef INCLUDED_sysdir_h_
+ − 24 #define INCLUDED_sysdir_h_
+ − 25
428
+ − 26 #ifdef HAVE_UNISTD_H
+ − 27 #include <unistd.h>
+ − 28 #endif
+ − 29
+ − 30 #ifdef SYSV_SYSTEM_DIR
647
+ − 31 # define select select_ /* Shadowing yuck */
428
+ − 32 # include <dirent.h>
647
+ − 33 # undef select
442
+ − 34 #elif defined (WIN32_NATIVE)
+ − 35 # include <direct.h>
+ − 36 # include "ndir.h"
432
+ − 37 #elif defined (NONSYSTEM_DIR_LIBRARY)
428
+ − 38 # include "ndir.h"
+ − 39 #else
+ − 40 # include <sys/dir.h>
+ − 41 #endif /* not NONSYSTEM_DIR_LIBRARY */
+ − 42
+ − 43 #ifdef SYSV_SYSTEM_DIR
+ − 44 # define DIRENTRY struct dirent
+ − 45 #else /* not SYSV_SYSTEM_DIR */
+ − 46 # define DIRENTRY struct direct
+ − 47 #endif
+ − 48
+ − 49 /* The d_nameln member of a struct dirent includes the '\0' character
+ − 50 on some systems, but not on others. What's worse, you can't tell
+ − 51 at compile-time which one it will be, since it really depends on
+ − 52 the sort of system providing the filesystem you're reading from,
+ − 53 not the system you are running on. Paul Eggert
+ − 54 <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
+ − 55 SunOS 4.1.2 host, reading a directory that is remote-mounted from a
+ − 56 Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
+ − 57
+ − 58 (and Solaris 2 doesn't have a d_nameln member at all! Posix.1
+ − 59 doesn't specify it -- mrb)
+ − 60
+ − 61 Since applying strlen to the name always works, we'll just do that. */
+ − 62 #define NAMLEN(p) strlen (p->d_name)
+ − 63
+ − 64 #define DIRENTRY_NONEMPTY(p) ((p)->d_ino)
+ − 65
+ − 66 /* encapsulation: directory calls */
+ − 67
+ − 68 #ifdef ENCAPSULATE_CHDIR
442
+ − 69 int sys_chdir (const char *path);
428
+ − 70 #endif
+ − 71 #if defined (ENCAPSULATE_CHDIR) && !defined (DONT_ENCAPSULATE)
+ − 72 # undef chdir
+ − 73 # define chdir sys_chdir
+ − 74 #endif
+ − 75 #if !defined (ENCAPSULATE_CHDIR) && defined (DONT_ENCAPSULATE)
+ − 76 # define sys_chdir chdir
+ − 77 #endif
+ − 78
+ − 79 #ifdef ENCAPSULATE_MKDIR
442
+ − 80 int sys_mkdir (const char *path, mode_t mode);
428
+ − 81 #endif
+ − 82 #if defined (ENCAPSULATE_MKDIR) && !defined (DONT_ENCAPSULATE)
+ − 83 # undef mkdir
+ − 84 # define mkdir sys_mkdir
+ − 85 #endif
+ − 86 #if !defined (ENCAPSULATE_MKDIR) && defined (DONT_ENCAPSULATE)
+ − 87 # define sys_mkdir mkdir
+ − 88 #endif
+ − 89
+ − 90 #ifdef ENCAPSULATE_OPENDIR
442
+ − 91 DIR *sys_opendir (const char *filename);
428
+ − 92 #endif
+ − 93 #if defined (ENCAPSULATE_OPENDIR) && !defined (DONT_ENCAPSULATE)
+ − 94 # undef opendir
+ − 95 # define opendir sys_opendir
+ − 96 #endif
+ − 97 #if !defined (ENCAPSULATE_OPENDIR) && defined (DONT_ENCAPSULATE)
+ − 98 # define sys_opendir opendir
+ − 99 #endif
+ − 100
+ − 101 #ifdef ENCAPSULATE_READDIR
+ − 102 DIRENTRY *sys_readdir (DIR *dirp);
+ − 103 #endif
+ − 104 #if defined (ENCAPSULATE_READDIR) && !defined (DONT_ENCAPSULATE)
+ − 105 # undef readdir
+ − 106 # define readdir sys_readdir
+ − 107 #endif
+ − 108 #if !defined (ENCAPSULATE_READDIR) && defined (DONT_ENCAPSULATE)
+ − 109 # define sys_readdir readdir
+ − 110 #endif
+ − 111
+ − 112 #ifdef ENCAPSULATE_CLOSEDIR
+ − 113 int sys_closedir (DIR *dirp);
+ − 114 #endif
+ − 115 #if defined (ENCAPSULATE_CLOSEDIR) && !defined (DONT_ENCAPSULATE)
+ − 116 # undef closedir
+ − 117 # define closedir sys_closedir
+ − 118 #endif
+ − 119 #if !defined (ENCAPSULATE_CLOSEDIR) && defined (DONT_ENCAPSULATE)
+ − 120 # define sys_closedir closedir
+ − 121 #endif
+ − 122
+ − 123 #ifdef ENCAPSULATE_RMDIR
442
+ − 124 int sys_rmdir (const char *path);
428
+ − 125 #endif
+ − 126 #if defined (ENCAPSULATE_RMDIR) && !defined (DONT_ENCAPSULATE)
+ − 127 # undef rmdir
+ − 128 # define rmdir sys_rmdir
+ − 129 #endif
+ − 130 #if !defined (ENCAPSULATE_RMDIR) && defined (DONT_ENCAPSULATE)
+ − 131 # define sys_rmdir rmdir
+ − 132 #endif
+ − 133
440
+ − 134 #endif /* INCLUDED_sysdir_h_ */