source: trunk/third/findutils/lib/modetype.h @ 18890

Revision 18890, 2.7 KB checked in by zacheiss, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18889, which included commits to RCS files with non-trunk default branches.
Line 
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.
4
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.
9
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.
14
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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
18
19/* POSIX.1 doesn't mention the S_IFMT bits; instead, it uses S_IStype
20   test macros.  To make storing file types more convenient, define
21   them; the values don't need to correspond to what the kernel uses,
22   because of the way we use them. */
23#ifndef S_IFMT                  /* Doesn't have traditional Unix macros. */
24#define S_IFBLK 1
25#define S_IFCHR 2
26#define S_IFDIR 4
27#define S_IFREG 8
28#ifdef S_ISLNK
29#define S_IFLNK 16
30#endif
31#ifdef S_ISFIFO
32#define S_IFIFO 32
33#endif
34#ifdef S_ISSOCK
35#define S_IFSOCK 64
36#endif
37#ifdef S_ISDOOR
38#define S_IFDOOR 128
39#endif
40#endif /* !S_IFMT */
41
42#ifdef STAT_MACROS_BROKEN
43#undef S_ISBLK
44#undef S_ISCHR
45#undef S_ISDIR
46#undef S_ISREG
47#undef S_ISFIFO
48#undef S_ISLNK
49#undef S_ISSOCK
50#undef S_ISDOOR
51#undef S_ISMPB
52#undef S_ISMPC
53#undef S_ISNWK
54#endif
55
56/* Do the reverse: define the POSIX.1 macros for traditional Unix systems
57   that don't have them.  */
58#if !defined(S_ISBLK) && defined(S_IFBLK)
59#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
60#endif
61#if !defined(S_ISCHR) && defined(S_IFCHR)
62#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
63#endif
64#if !defined(S_ISDIR) && defined(S_IFDIR)
65#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
66#endif
67#if !defined(S_ISREG) && defined(S_IFREG)
68#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
69#endif
70#if !defined(S_ISFIFO) && defined(S_IFIFO)
71#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
72#endif
73#if !defined(S_ISLNK) && defined(S_IFLNK)
74#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
75#endif
76#if !defined(S_ISSOCK) && defined(S_IFSOCK)
77#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
78#endif
79#if !defined(S_ISDOOR) && defined(S_IFDOOR)
80#define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR)
81#endif
82#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
83#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
84#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
85#endif
86#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
87#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
88#endif
Note: See TracBrowser for help on using the repository browser.