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 / c-stat.h < prev    next >
C/C++ Source or Header  |  1993-06-24  |  2KB  |  63 lines

  1. /* c-stat.h: declarations for using stat(2).
  2.  
  3. Copyright (C) 1993 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_STAT_H
  20. #define KPATHSEA_STAT_H
  21.  
  22. #include <kpathsea/systypes.h>
  23. #include <sys/stat.h>
  24.  
  25. /* POSIX predicates for testing file attributes.  */
  26.  
  27. #if !defined (S_ISBLK) && defined (S_IFBLK)
  28. #define    S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
  29. #endif
  30. #if !defined (S_ISCHR) && defined (S_IFCHR)
  31. #define    S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
  32. #endif
  33. #if !defined (S_ISDIR) && defined (S_IFDIR)
  34. #define    S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  35. #endif
  36. #if !defined (S_ISREG) && defined (S_IFREG)
  37. #define    S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
  38. #endif
  39. #if !defined (S_ISFIFO) && defined (S_IFIFO)
  40. #define    S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
  41. #endif
  42. #if !defined (S_ISLNK) && defined (S_IFLNK)
  43. #define    S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
  44. #endif
  45. #if !defined (S_ISSOCK) && defined (S_IFSOCK)
  46. #define    S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
  47. #endif
  48. #if !defined (S_ISMPB) && defined (S_IFMPB) /* V7 */
  49. #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
  50. #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
  51. #endif
  52. #if !defined (S_ISNWK) && defined (S_IFNWK) /* HP/UX */
  53. #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
  54. #endif
  55.  
  56. /* Two files are indistinguishable if they are on the same device
  57.    and have the same inode.  This checks two stat buffers for that.  Cf.
  58.    the `same_file_p' routine in file-p.c, declared in kpathlib.h.  */
  59. #define SAME_FILE_P(s1, s2) \
  60.   ((s1).st_ino == (s2).st_ino && (s1).st_dev == (s2).st_dev)
  61.  
  62. #endif /* not KPATHSEA_STAT_H */
  63.