]> Dogcows Code - chaz/tar/blob - src/port.h
*** empty log message ***
[chaz/tar] / src / port.h
1 /* Portability declarations. Requires sys/types.h.
2 Copyright (C) 1988, 1992 Free Software Foundation
3
4 This file is part of GNU Tar.
5
6 GNU Tar is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Tar is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Tar; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 /* AIX requires this to be the first thing in the file. */
21 #ifdef __GNUC__
22 #define alloca __builtin_alloca
23 #else /* not __GNUC__ */
24 #if HAVE_ALLOCA_H
25 #include <alloca.h>
26 #else /* not HAVE_ALLOCA_H */
27 #ifdef _AIX
28 #pragma alloca
29 #else /* not _AIX */
30 char *alloca ();
31 #endif /* not _AIX */
32 #endif /* not HAVE_ALLOCA_H */
33 #endif /* not __GNUC__ */
34
35 #include "pathmax.h"
36
37 #ifdef _POSIX_VERSION
38 #include <sys/wait.h>
39 #else /* !_POSIX_VERSION */
40 #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
41 #define WIFSIGNALED(w) (((w) & 0xff) != 0x7f && ((w) & 0xff) != 0)
42 #define WIFEXITED(w) (((w) & 0xff) == 0)
43
44 #define WSTOPSIG(w) (((w) >> 8) & 0xff)
45 #define WTERMSIG(w) ((w) & 0x7f)
46 #define WEXITSTATUS(w) (((w) >> 8) & 0xff)
47 #endif /* _POSIX_VERSION */
48
49 /* nonstandard */
50 #ifndef WIFCOREDUMPED
51 #define WIFCOREDUMPED(w) (((w) & 0x80) != 0)
52 #endif
53
54 #ifdef __MSDOS__
55 /* missing things from sys/stat.h */
56 #define S_ISUID 0
57 #define S_ISGID 0
58 #define S_ISVTX 0
59
60 /* device stuff */
61 #define makedev(ma, mi) ((ma << 8) | mi)
62 #define major(dev) (dev)
63 #define minor(dev) (dev)
64 typedef long off_t;
65 #endif /* __MSDOS__ */
66
67 #if defined(__STDC__) || defined(__TURBOC__)
68 #define PTR void *
69 #else
70 #define PTR char *
71 #endif
72
73 /* Since major is a function on SVR4, we can't just use `ifndef major'. */
74 #ifdef major /* Might be defined in sys/types.h. */
75 #define HAVE_MAJOR
76 #endif
77
78 #if !defined(HAVE_MAJOR) && defined(MAJOR_IN_MKDEV)
79 #include <sys/mkdev.h>
80 #define HAVE_MAJOR
81 #endif
82
83 #if !defined(HAVE_MAJOR) && defined(MAJOR_IN_SYSMACROS)
84 #include <sys/sysmacros.h>
85 #define HAVE_MAJOR
86 #endif
87
88 #ifndef HAVE_MAJOR
89 #define major(dev) (((dev) >> 8) & 0xff)
90 #define minor(dev) ((dev) & 0xff)
91 #define makedev(maj, min) (((maj) << 8) | (min))
92 #endif
93 #undef HAVE_MAJOR
94
95 #if defined(STDC_HEADERS) || defined(USG)
96 #include <string.h>
97 #if !defined(__MSDOS__) && !defined(STDC_HEADERS)
98 #include <memory.h>
99 #endif
100 #ifdef index
101 #undef index
102 #endif
103 #ifdef rindex
104 #undef rindex
105 #endif
106 #define index strchr
107 #define rindex strrchr
108 #define bcopy(s, d, n) memcpy(d, s, n)
109 #define bzero(s, n) memset(s, 0, n)
110 #define bcmp memcmp
111 #else
112 #include <strings.h>
113 #endif
114
115 #if defined(STDC_HEADERS)
116 #include <stdlib.h>
117 #else
118 char *malloc(), *realloc();
119 char *getenv();
120 #endif
121
122 #ifndef _POSIX_VERSION
123 #ifdef __MSDOS__
124 #include <io.h>
125 #else /* !__MSDOS__ */
126 off_t lseek();
127 #endif /* !__MSDOS__ */
128 char *getcwd();
129 #endif /* !_POSIX_VERSION */
130
131 #ifndef NULL
132 #define NULL 0
133 #endif
134
135 #ifndef O_BINARY
136 #define O_BINARY 0
137 #endif
138 #ifndef O_CREAT
139 #define O_CREAT 0
140 #endif
141 #ifndef O_NDELAY
142 #define O_NDELAY 0
143 #endif
144 #ifndef O_RDONLY
145 #define O_RDONLY 0
146 #endif
147 #ifndef O_RDWR
148 #define O_RDWR 2
149 #endif
150
151 #include <sys/stat.h>
152 #ifndef S_ISREG /* Doesn't have POSIX.1 stat stuff. */
153 #define mode_t unsigned short
154 #endif
155 #if !defined(S_ISBLK) && defined(S_IFBLK)
156 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
157 #endif
158 #if !defined(S_ISCHR) && defined(S_IFCHR)
159 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
160 #endif
161 #if !defined(S_ISDIR) && defined(S_IFDIR)
162 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
163 #endif
164 #if !defined(S_ISREG) && defined(S_IFREG)
165 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
166 #endif
167 #if !defined(S_ISFIFO) && defined(S_IFIFO)
168 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
169 #define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
170 #endif
171 #if !defined(S_ISLNK) && defined(S_IFLNK)
172 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
173 #endif
174 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
175 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
176 #endif
177 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
178 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
179 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
180 #endif
181 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
182 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
183 #endif
184 #if !defined(S_ISCTG) && defined(S_IFCTG) /* contiguous file */
185 #define S_ISCTG(m) (((m) & S_IFMT) == S_IFCTG)
186 #endif
187 #if !defined(S_ISVTX)
188 #define S_ISVTX 0001000
189 #endif
This page took 0.048489 seconds and 4 git commands to generate.