home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / src / sysdir.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-01  |  3.2 KB  |  111 lines

  1. /*
  2.    Copyright (C) 1995 Amdahl Corporation.
  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 the Free
  18. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #ifdef SYSV_SYSTEM_DIR
  21. # include <dirent.h>
  22. #elif defined (NONSYSTEM_DIR_LIBRARY)
  23. # include "ndir.h"
  24. #elif defined (MSDOS)
  25. # include <dirent.h>
  26. #else
  27. # include <sys/dir.h>
  28. #endif /* not NONSYSTEM_DIR_LIBRARY */
  29.  
  30. #ifdef SYSV_SYSTEM_DIR
  31. # define DIRENTRY struct dirent
  32. #else /* not SYSV_SYSTEM_DIR */
  33. # define DIRENTRY struct direct
  34. #endif
  35.  
  36. /* The d_nameln member of a struct dirent includes the '\0' character
  37.    on some systems, but not on others.  What's worse, you can't tell
  38.    at compile-time which one it will be, since it really depends on
  39.    the sort of system providing the filesystem you're reading from,
  40.    not the system you are running on.  Paul Eggert
  41.    <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
  42.    SunOS 4.1.2 host, reading a directory that is remote-mounted from a
  43.    Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
  44.  
  45.    Since applying strlen to the name always works, we'll just do that.  */
  46. #define NAMLEN(p) strlen (p->d_name)
  47.  
  48. #ifdef MSDOS
  49. #define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
  50. #else
  51. #define DIRENTRY_NONEMPTY(p) ((p)->d_ino)
  52. #endif
  53.  
  54. /* encapsulation: directory calls */
  55.  
  56. #ifdef ENCAPSULATE_CHDIR
  57. extern int sys_chdir (CONST char *path);
  58. #endif
  59. #if defined (ENCAPSULATE_CHDIR) && !defined (DONT_ENCAPSULATE)
  60. # undef chdir
  61. # define chdir sys_chdir
  62. #endif
  63. #if !defined (ENCAPSULATE_CHDIR) && defined (DONT_ENCAPSULATE)
  64. # define sys_chdir chdir
  65. #endif
  66.  
  67. #ifdef ENCAPSULATE_MKDIR
  68. extern int sys_mkdir (CONST char *path, int mode);
  69. #endif
  70. #if defined (ENCAPSULATE_MKDIR) && !defined (DONT_ENCAPSULATE)
  71. # undef mkdir
  72. # define mkdir sys_mkdir
  73. #endif
  74. #if !defined (ENCAPSULATE_MKDIR) && defined (DONT_ENCAPSULATE)
  75. # define sys_mkdir mkdir
  76. #endif
  77.  
  78. #ifdef ENCAPSULATE_OPENDIR
  79. extern DIR *sys_opendir (CONST char *filename);
  80. #endif
  81. #if defined (ENCAPSULATE_OPENDIR) && !defined (DONT_ENCAPSULATE)
  82. # undef opendir
  83. # define opendir sys_opendir
  84. #endif
  85. #if !defined (ENCAPSULATE_OPENDIR) && defined (DONT_ENCAPSULATE)
  86. # define sys_opendir opendir
  87. #endif
  88.  
  89. #ifdef ENCAPSULATE_READDIR
  90. extern DIRENTRY *sys_readdir (DIR *dirp);
  91. #endif
  92. #if defined (ENCAPSULATE_READDIR) && !defined (DONT_ENCAPSULATE)
  93. # undef readdir
  94. # define readdir sys_readdir
  95. #endif
  96. #if !defined (ENCAPSULATE_READDIR) && defined (DONT_ENCAPSULATE)
  97. # define sys_readdir readdir
  98. #endif
  99.  
  100. #ifdef ENCAPSULATE_RMDIR
  101. extern int sys_rmdir (CONST char *path);
  102. #endif
  103. #if defined (ENCAPSULATE_RMDIR) && !defined (DONT_ENCAPSULATE)
  104. # undef rmdir
  105. # define rmdir sys_rmdir
  106. #endif
  107. #if !defined (ENCAPSULATE_RMDIR) && defined (DONT_ENCAPSULATE)
  108. # define sys_rmdir rmdir
  109. #endif
  110.  
  111.