2 |
- |
1 |
/* Wrapper around the ugly sys/stat includes/ifdefs */
|
|
|
2 |
/* $Id$ */
|
|
|
3 |
|
|
|
4 |
/* assumes <sys/types.h> already included */
|
|
|
5 |
#include <sys/stat.h>
|
|
|
6 |
|
|
|
7 |
#ifndef HAVE_LSTAT
|
|
|
8 |
# define lstat(path, buf) stat(path, buf)
|
|
|
9 |
#endif /* HAVE_LSTAT */
|
|
|
10 |
|
|
|
11 |
#ifdef STAT_MACROS_BROKEN
|
|
|
12 |
# undef S_ISREG
|
|
|
13 |
# undef S_ISDIR
|
|
|
14 |
# undef S_ISCHR
|
|
|
15 |
# undef S_ISBLK
|
|
|
16 |
# undef S_ISFIFO
|
|
|
17 |
# undef S_ISSOCK
|
|
|
18 |
# undef S_ISLNK
|
|
|
19 |
#endif /* STAT_MACROS_BROKEN */
|
|
|
20 |
|
|
|
21 |
#if !defined(S_ISREG) && defined(S_IFREG)
|
|
|
22 |
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
|
|
23 |
#endif /* S_ISREG */
|
|
|
24 |
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
|
|
25 |
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
|
|
26 |
#endif /* S_ISDIR */
|
|
|
27 |
#if !defined(S_ISCHR) && defined(S_IFCHR)
|
|
|
28 |
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
|
|
29 |
#endif /* S_ISCHR */
|
|
|
30 |
#if !defined(S_ISBLK) && defined(S_IFBLK)
|
|
|
31 |
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
|
|
32 |
#endif /* S_ISBLK */
|
|
|
33 |
#if !defined(S_ISFIFO) && defined(S_IFIFO)
|
|
|
34 |
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
|
|
35 |
#endif /* S_ISFIFO */
|
|
|
36 |
#if !defined(S_ISLNK) && defined(S_IFLNK)
|
|
|
37 |
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
|
|
38 |
#endif /* S_ISLNK */
|
|
|
39 |
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
|
|
|
40 |
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
|
|
41 |
#endif /* S_ISSOCK */
|
|
|
42 |
#if !defined(S_ISCDF) && defined(S_CDF)
|
|
|
43 |
# define S_ISCDF(m) (S_ISDIR(m) && ((m) & S_CDF))
|
|
|
44 |
#endif /* S_ISSOCK */
|
|
|
45 |
|
|
|
46 |
#ifndef S_ISVTX
|
|
|
47 |
# define S_ISVTX 01000 /* sticky bit */
|
|
|
48 |
#endif /* S_ISVTX */
|
|
|
49 |
|
|
|
50 |
#ifndef S_IXUSR
|
|
|
51 |
# define S_IXUSR 00100 /* user execute bit */
|
|
|
52 |
#endif /* S_IXUSR */
|
|
|
53 |
#ifndef S_IXGRP
|
|
|
54 |
# define S_IXGRP 00010 /* user execute bit */
|
|
|
55 |
#endif /* S_IXGRP */
|
|
|
56 |
#ifndef S_IXOTH
|
|
|
57 |
# define S_IXOTH 00001 /* user execute bit */
|
|
|
58 |
#endif /* S_IXOTH */
|