home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-base.tgz / octave-1.1.1p1-base.tar / fsf / octave / kpathsea / dir.h < prev    next >
C/C++ Source or Header  |  1995-01-16  |  2KB  |  59 lines

  1. /* dir.h: checked directory operations.
  2.  
  3. Copyright (C) 1992, 93 Free Software Foundation, Inc.
  4.  
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. #ifndef KPATHSEA_DIR_H
  20. #define KPATHSEA_DIR_H
  21.  
  22. #include <kpathsea/c-proto.h>
  23. #include <kpathsea/types.h>
  24.  
  25. /* Use struct dirent instead of struct direct.  */
  26. #if defined (HAVE_DIRENT_H) || defined (_POSIX_VERSION)
  27. #include <dirent.h>
  28. #define NLENGTH(dirent) strlen ((dirent)->d_name)
  29. #else /* not (HAVE_DIRENT_H or _POSIX_VERSION) */
  30. #define dirent direct
  31. #define NLENGTH(dirent) ((dirent)->d_namlen)
  32.  
  33. #ifdef HAVE_SYS_NDIR_H
  34. #include <sys/ndir.h>
  35. #endif
  36.  
  37. #ifdef HAVE_NDIR_H
  38. #include <ndir.h>
  39. #endif
  40.  
  41. #ifdef HAVE_SYS_DIR_H
  42. #include <sys/dir.h>
  43. #endif
  44.  
  45. #endif /* not (HAVE_DIRENT_H or _POSIX_VERSION) */
  46.  
  47. /* Like opendir, closedir, and chdir, but abort if DIRNAME can't be opened.  */
  48. extern DIR *xopendir P1H(string dirname);
  49. extern void xclosedir P1H(DIR *);
  50.  
  51. /* Returns true if FN is a directory or a symlink to a directory.  */
  52. extern boolean dir_p P1H(const_string fn);
  53.  
  54. /* If FN is a readable directory, return the number of links it has.
  55.    Otherwise, return -1.  */
  56. extern int dir_links P1H(const_string fn);
  57.  
  58. #endif /* not KPATHSEA_DIR_H */
  59.