Update code to reflect gnulib's changes to the arguments of human_readable(). Drop...
[findutils.git] / lib / modetype.h
blob28a7994e7c405f1246a306d626e6aead9cfd34e1
1 /* modetype.h -- file type bits definitions for POSIX systems
2 Requires sys/types.h sys/stat.h.
3 Copyright (C) 1990 Free Software Foundation, Inc.
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.
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.
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., 9 Temple Place - Suite 330, Boston, MA 02111-1307,
18 USA.
21 /* POSIX.1 doesn't mention the S_IFMT bits; instead, it uses S_IStype
22 test macros. To make storing file types more convenient, define
23 them; the values don't need to correspond to what the kernel uses,
24 because of the way we use them. */
25 #ifndef S_IFMT /* Doesn't have traditional Unix macros. */
26 #define S_IFBLK 1
27 #define S_IFCHR 2
28 #define S_IFDIR 4
29 #define S_IFREG 8
30 #ifdef S_ISLNK
31 #define S_IFLNK 16
32 #endif
33 #ifdef S_ISFIFO
34 #define S_IFIFO 32
35 #endif
36 #ifdef S_ISSOCK
37 #define S_IFSOCK 64
38 #endif
39 #ifdef S_ISDOOR
40 #define S_IFDOOR 128
41 #endif
42 #endif /* !S_IFMT */
44 #ifdef STAT_MACROS_BROKEN
45 #undef S_ISBLK
46 #undef S_ISCHR
47 #undef S_ISDIR
48 #undef S_ISREG
49 #undef S_ISFIFO
50 #undef S_ISLNK
51 #undef S_ISSOCK
52 #undef S_ISDOOR
53 #undef S_ISMPB
54 #undef S_ISMPC
55 #undef S_ISNWK
56 #endif
58 /* Do the reverse: define the POSIX.1 macros for traditional Unix systems
59 that don't have them. */
60 #if !defined(S_ISBLK) && defined(S_IFBLK)
61 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
62 #endif
63 #if !defined(S_ISCHR) && defined(S_IFCHR)
64 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
65 #endif
66 #if !defined(S_ISDIR) && defined(S_IFDIR)
67 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
68 #endif
69 #if !defined(S_ISREG) && defined(S_IFREG)
70 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
71 #endif
72 #if !defined(S_ISFIFO) && defined(S_IFIFO)
73 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
74 #endif
75 #if !defined(S_ISLNK) && defined(S_IFLNK)
76 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
77 #endif
78 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
79 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
80 #endif
81 #if !defined(S_ISDOOR) && defined(S_IFDOOR)
82 #define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
83 #endif
84 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
85 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
86 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
87 #endif
88 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
89 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
90 #endif