| 1 | /* |
| 2 | * Copyright (C) 2000 Ross Combs ([email protected]) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | #ifndef INCLUDED_STATMACROS_PROTOS |
| 19 | #define INCLUDED_STATMACROS_PROTOS |
| 20 | |
| 21 | #ifdef STAT_MACROS_BROKEN |
| 22 | # ifdef S_ISREG |
| 23 | # undef S_ISREG |
| 24 | # endif |
| 25 | # ifdef S_ISDIR |
| 26 | # undef S_ISDIR |
| 27 | # endif |
| 28 | # ifdef S_ISCHR |
| 29 | # undef S_ISCHR |
| 30 | # endif |
| 31 | # ifdef S_ISBLK |
| 32 | # undef S_ISBLK |
| 33 | # endif |
| 34 | # ifdef S_ISFIFO |
| 35 | # undef S_ISFIFO |
| 36 | # endif |
| 37 | # ifdef S_ISSOCK |
| 38 | # undef S_ISSOCK |
| 39 | # endif |
| 40 | # ifdef S_ISLNK |
| 41 | # undef S_ISLNK |
| 42 | # endif |
| 43 | #endif |
| 44 | |
| 45 | #ifndef S_IFMT |
| 46 | # define S_IFMT 0170000 |
| 47 | #endif |
| 48 | |
| 49 | #ifndef S_ISREG |
| 50 | # ifdef S_IFREG |
| 51 | # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) |
| 52 | # endif |
| 53 | #endif |
| 54 | #ifndef S_ISDIR |
| 55 | # ifdef S_IFDIR |
| 56 | # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
| 57 | # endif |
| 58 | #endif |
| 59 | #ifndef S_ISCHR |
| 60 | # ifdef S_IFCHR |
| 61 | # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) |
| 62 | # endif |
| 63 | #endif |
| 64 | #ifndef S_ISBLK |
| 65 | # ifdef S_IFBLK |
| 66 | # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) |
| 67 | # endif |
| 68 | #endif |
| 69 | #ifndef S_ISFIFO |
| 70 | # ifdef S_IFIFO |
| 71 | # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) |
| 72 | # endif |
| 73 | #endif |
| 74 | #ifndef S_ISLNK |
| 75 | # ifdef S_IFLNK |
| 76 | # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) |
| 77 | # endif |
| 78 | #endif |
| 79 | #ifndef S_ISSOCK |
| 80 | # ifdef S_IFSOCK |
| 81 | # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) |
| 82 | # endif |
| 83 | #endif |
| 84 | #ifndef S_ISCDF |
| 85 | # ifdef S_CDF |
| 86 | # define S_ISCDF(m) (S_ISDIR(m) && ((m) & S_CDF)) |
| 87 | # endif |
| 88 | #endif |
| 89 | #ifndef S_ISMPB |
| 90 | # ifdef S_IFMPB /* V7 */ |
| 91 | # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) |
| 92 | # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) |
| 93 | # endif |
| 94 | #endif |
| 95 | #ifndef S_ISNWK |
| 96 | # ifdef S_IFNWK /* HP/UX */ |
| 97 | # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) |
| 98 | # endif |
| 99 | #endif |
| 100 | |
| 101 | #ifndef S_ISUID |
| 102 | # define S_ISUID 01000 /* set user ID */ |
| 103 | #endif |
| 104 | #ifndef S_ISGID |
| 105 | # define S_ISGID 01000 /* set group ID */ |
| 106 | #endif |
| 107 | #ifndef S_ISVTX |
| 108 | # define S_ISVTX 01000 /* sticky bit */ |
| 109 | #endif |
| 110 | |
| 111 | #ifndef S_IRUSR |
| 112 | # ifdef S_IREAD |
| 113 | # define S_IRUSR S_IREAD |
| 114 | # else |
| 115 | # define S_IRUSR 00400 |
| 116 | # endif |
| 117 | #endif |
| 118 | #ifndef S_IWUSR |
| 119 | # ifdef S_IWRITE |
| 120 | # define S_IWUSR S_IWRITE |
| 121 | # else |
| 122 | # define S_IWUSR 00200 |
| 123 | # endif |
| 124 | #endif |
| 125 | #ifndef S_IXUSR |
| 126 | # ifdef S_IEXEC |
| 127 | # define S_IXUSR S_IEXEC |
| 128 | # else |
| 129 | # define S_IXUSR 00100 |
| 130 | # endif |
| 131 | #endif |
| 132 | #ifndef S_IRWXU |
| 133 | # define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR) |
| 134 | #endif |
| 135 | #ifndef S_IRGRP |
| 136 | # define S_IRGRP (S_IRUSR >> 3) |
| 137 | #endif |
| 138 | #ifndef S_IWGRP |
| 139 | # define S_IWGRP (S_IWUSR >> 3) |
| 140 | #endif |
| 141 | #ifndef S_IXGRP |
| 142 | # define S_IXGRP (S_IXUSR >> 3) |
| 143 | #endif |
| 144 | #ifndef S_IRWXG |
| 145 | # define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP) |
| 146 | #endif |
| 147 | |
| 148 | #ifndef S_IROTH |
| 149 | # define S_IROTH (S_IRGRP >> 3) |
| 150 | #endif |
| 151 | #ifndef S_IWOTH |
| 152 | # define S_IWOTH (S_IWGRP >> 3) |
| 153 | #endif |
| 154 | #ifndef S_IXOTH |
| 155 | # define S_IXOTH (S_IXGRP >> 3) |
| 156 | #endif |
| 157 | #ifndef S_IRWXO |
| 158 | # define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH) |
| 159 | #endif |
| 160 | |
| 161 | #endif |