1/* Replacement sys/stat.h file for building GNU Emacs on the Macintosh.
2   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
3      2005, 2006, 2007  Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs; see the file COPYING.  If not, write to
19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA.  */
21
22/* Contributed by Andrew Choi (akochoi@mac.com).  */
23
24#ifndef _SYS_STAT_H
25#define _SYS_STAT_H
26
27#ifdef __MWERKS__
28#include <stat.mac.h>
29
30#if __MSL__ >= 0x6000
31#define fstat _fstat
32#endif
33
34#undef S_IFMT
35#undef S_IFBLK
36#undef S_IFCHR
37#undef S_IFIFO
38#undef S_IFREG
39#undef S_IFDIR
40#undef S_IFLNK
41
42#undef S_IRUSR
43#undef S_IWUSR
44#undef S_IXUSR
45
46#endif  /* __MWERKS__ */
47
48/* Need to redefine these for CW, filemode.c assumes Unix definitions which are
49   inconsistent with CW definitions because CW uses bits 8-12 for S_IFMT info.
50   Bit 8 is used by S_IRUSR on Unix! */
51#define	S_IFMT	0170000		/* type of file */
52#define S_IFBLK	0060000		/* block special */
53#define S_IFCHR	0020000		/* character special */
54#define S_IFIFO	0010000		/* FIFO special */
55#define S_IFREG	0100000		/* regular */
56#define S_IFDIR	0040000		/* directory */
57#define S_IFLNK	0030000		/* symbolic link */
58
59#define S_IREAD  00400
60#define S_IWRITE 00200
61#define S_IEXEC  00100
62
63/* Need to redefine these for because mode_string in filemode.c assumes Unix
64   values in the lower 9 bits which are different from CW values.  */
65#define S_IRUSR S_IREAD
66#define S_IWUSR S_IWRITE
67#define S_IXUSR S_IEXEC
68
69#ifdef __MRC__
70typedef unsigned long dev_t;
71
72struct stat {
73  dev_t st_dev;			/* ID of device containing file */
74  int st_ino;			/* file serial number */
75  unsigned short st_mode;	/* mode of file */
76  int st_nlink;			/* number of links to the file */
77  int st_uid;			/* user ID of file */
78  int st_gid;			/* group ID of file */
79  int st_rdev;			/* device ID (if file is character or block special) */
80  int st_size;			/* file size in bytes (if file is a regular file) */
81  int st_atime;			/* time of last access */
82  int st_mtime;			/* time of last data modification */
83  int st_ctime;			/* time of last status change */
84};
85#endif  /* __MRC__ */
86
87#endif /* _SYS_STAT_H */
88
89/* arch-tag: b7da83f5-3d3f-4b19-9cd2-790dd87145e4
90   (do not change this comment) */
91