1 |
/* filetypes.h - deal with POSIX annoyances |
2 |
Copyright (C) 1991 Free Software Foundation, Inc. |
3 |
|
4 |
This program is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
6 |
the Free Software Foundation; either version 2, or (at your option) |
7 |
any later version. |
8 |
|
9 |
This program is distributed in the hope that it will be useful, |
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 |
GNU General Public License for more details. |
13 |
|
14 |
You should have received a copy of the GNU General Public License |
15 |
along with this program; if not, write to the Free Software |
16 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
17 |
|
18 |
/* Include sys/types.h and sys/stat.h before this file. */ |
19 |
|
20 |
#ifndef S_ISREG /* Doesn't have POSIX.1 stat stuff. */ |
21 |
#define mode_t unsigned short |
22 |
#endif |
23 |
|
24 |
/* Define the POSIX macros for systems that lack them. */ |
25 |
#if !defined(S_ISBLK) && defined(S_IFBLK) |
26 |
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) |
27 |
#endif |
28 |
#if !defined(S_ISCHR) && defined(S_IFCHR) |
29 |
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) |
30 |
#endif |
31 |
#if !defined(S_ISDIR) && defined(S_IFDIR) |
32 |
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
33 |
#endif |
34 |
#if !defined(S_ISREG) && defined(S_IFREG) |
35 |
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) |
36 |
#endif |
37 |
#if !defined(S_ISFIFO) && defined(S_IFIFO) |
38 |
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) |
39 |
#endif |
40 |
#if !defined(S_ISLNK) && defined(S_IFLNK) |
41 |
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) |
42 |
#endif |
43 |
#if !defined(S_ISSOCK) && defined(S_IFSOCK) |
44 |
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) |
45 |
#endif |
46 |
#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX network special */ |
47 |
#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) |
48 |
#endif |
49 |
|
50 |
/* Define the file type bits used in cpio archives. |
51 |
They have the same values as the S_IF bits in traditional Unix. */ |
52 |
|
53 |
#define CP_IFMT 0170000 /* Mask for all file type bits. */ |
54 |
|
55 |
#if defined(S_ISBLK) |
56 |
#define CP_IFBLK 0060000 |
57 |
#endif |
58 |
#if defined(S_ISCHR) |
59 |
#define CP_IFCHR 0020000 |
60 |
#endif |
61 |
#if defined(S_ISDIR) |
62 |
#define CP_IFDIR 0040000 |
63 |
#endif |
64 |
#if defined(S_ISREG) |
65 |
#define CP_IFREG 0100000 |
66 |
#endif |
67 |
#if defined(S_ISFIFO) |
68 |
#define CP_IFIFO 0010000 |
69 |
#endif |
70 |
#if defined(S_ISLNK) |
71 |
#define CP_IFLNK 0120000 |
72 |
#endif |
73 |
#if defined(S_ISSOCK) |
74 |
#define CP_IFSOCK 0140000 |
75 |
#endif |
76 |
#if defined(S_ISNWK) |
77 |
#define CP_IFNWK 0110000 |
78 |
#endif |
79 |
|
80 |
#ifndef S_ISLNK |
81 |
#define lstat stat |
82 |
#endif |
83 |
int lstat (); |
84 |
int stat (); |