1 /* Return a string describing the type of a file.
3 Copyright (C) 1993, 1994, 2001, 2002, 2004 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)
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 Foundation,
17 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19 /* Written by Paul Eggert and Jim Meyering. */
22 # define FILE_TYPE_H 1
24 # if ! defined S_ISREG && ! defined S_IFREG
25 you must include
<sys
/stat
.h
> before including
this file
28 char const *file_type (struct stat
const *);
31 # define S_IFMT 0170000
34 # if STAT_MACROS_BROKEN
52 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
60 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
68 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
74 # ifndef S_ISDOOR /* Solaris 2.5 and up */
76 # define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
78 # define S_ISDOOR(m) 0
84 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
86 # define S_ISFIFO(m) 0
92 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
98 # ifndef S_ISMPB /* V7 */
100 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
101 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
103 # define S_ISMPB(m) 0
104 # define S_ISMPC(m) 0
108 # ifndef S_ISNAM /* Xenix */
110 # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
112 # define S_ISNAM(m) 0
116 # ifndef S_ISNWK /* HP/UX */
118 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
120 # define S_ISNWK(m) 0
126 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
128 # define S_ISREG(m) 0
134 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
136 # define S_ISSOCK(m) 0
142 # define S_TYPEISMQ(p) 0
146 # define S_TYPEISTMO(p) 0
152 # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
154 # define S_TYPEISSEM(p) 0
160 # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
162 # define S_TYPEISSHM(p) 0
166 #endif /* FILE_TYPE_H */