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