filestat.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* filestat.h: Definitions for file statistics
  2. Copyright (C) 2002-2003 Sebastian Reichelt
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #ifndef FILESTAT_H
  15. #define FILESTAT_H
  16. #include "generic.h"
  17. #include <sys/stat.h>
  18. #ifdef WIN32
  19. #undef stat
  20. #define stat _stat
  21. #endif
  22. typedef struct stat FILE_STATS;
  23. #define GetFileStats(FileName,Stats) (stat ((FileName), &(Stats)))
  24. #define StatGetMode(Stat) ((Stat).st_mode)
  25. #define StatGetUID(Stat) ((Stat).st_uid)
  26. #define StatGetGID(Stat) ((Stat).st_gid)
  27. #define StatGetModificationTime(Stat) ((Stat).st_mtime)
  28. #define StatFileIsNewer(Stat1,Stat2) ((Stat1).st_mtime > (Stat2).st_mtime)
  29. #define StatCopyAttributes(Stat1,Stat2) ((Stat1).st_mode = (Stat2).st_mode, (Stat1).st_uid = (Stat2).st_uid, (Stat1).st_gid = (Stat2).st_gid, (Stat1).st_atime = (Stat2).st_atime, (Stat1).st_mtime = (Stat2).st_mtime, (Stat1).st_ctime = (Stat2).st_ctime)
  30. #endif