cstat.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. Copyright (c) 1990-1999 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 1999-Oct-05 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, both of these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html
  7. */
  8. /* cstat.h
  9. Definitions used for file status functions
  10. */
  11. #ifndef __STAT_H
  12. #define __STAT_H
  13. #include <stdio.h>
  14. #define S_IFMT 0xF000 /* file type mask */
  15. #define S_IFDIR 0x4000 /* directory */
  16. #define S_IFIFO 0x1000 /* FIFO special */
  17. #define S_IFCHR 0x2000 /* character special */
  18. #define S_IFBLK 0x3000 /* block special */
  19. #define S_IFREG 0x8000 /* or just 0x0000, regular */
  20. #define S_IREAD 0x0100 /* owner may read */
  21. #define S_IWRITE 0x0080 /* owner may write */
  22. #define S_IEXEC 0x0040 /* owner may execute <directory search> */
  23. struct stat
  24. {
  25. short st_dev; /* Drive number of disk containing the */
  26. /* file or file handle if the file is */
  27. /* on device */
  28. short st_ino; /* Not meaningfull for VM/CMS */
  29. short st_mode; /* Bit mask giving information about */
  30. /* the file's mode */
  31. short st_nlink; /* Set to the integer constant 1 */
  32. int st_uid; /* Not meaningfull for VM/CMS */
  33. int st_gid; /* Not meaningfull for VM/CMS */
  34. short st_rdev; /* Same as st_dev */
  35. long st_size; /* Size of the file in bytes */
  36. long st_atime; /* Most recent access */
  37. long st_mtime; /* Same as st_atime */
  38. long st_ctime; /* Same as st_atime */
  39. FILE *fp;
  40. char fname[FILENAME_MAX];
  41. };
  42. int stat(const char *path, struct stat *sb);
  43. int fstat(int fd, struct stat *sb);
  44. #endif /* __STAT_H */