]> 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 #define const
72 #endif
73
74 /* Since major is a function on SVR4, we can't just use `ifndef major'. */
75 #ifdef major /* Might be defined in sys/types.h. */
76 #define HAVE_MAJOR
77 #endif
78
79 #if !defined(HAVE_MAJOR) && defined(MAJOR_IN_MKDEV)
80 #include <sys/mkdev.h>
81 #define HAVE_MAJOR
82 #endif
83
84 #if !defined(HAVE_MAJOR) && defined(MAJOR_IN_SYSMACROS)
85 #include <sys/sysmacros.h>
86 #define HAVE_MAJOR
87 #endif
88
89 #ifndef HAVE_MAJOR
90 #define major(dev) (((dev) >> 8) & 0xff)
91 #define minor(dev) ((dev) & 0xff)
92 #define makedev(maj, min) (((maj) << 8) | (min))
93 #endif
94 #undef HAVE_MAJOR
95
96 #if defined(STDC_HEADERS) || defined(USG)
97 #include <string.h>
98 #if !defined(__MSDOS__) && !defined(STDC_HEADERS)
99 #include <memory.h>
100 #endif
101 #define index strchr
102 #define rindex strrchr
103 #define bcopy(s, d, n) memcpy(d, s, n)
104 #define bzero(s, n) memset(s, 0, n)
105 #define bcmp memcmp
106 #else
107 #include <strings.h>
108 #endif
109
110 #if defined(STDC_HEADERS)
111 #include <stdlib.h>
112 #else
113 char *malloc(), *realloc();
114 char *getenv();
115 #endif
116
117 #ifndef _POSIX_VERSION
118 #ifdef __MSDOS__
119 #include <io.h>
120 #else /* !__MSDOS__ */
121 off_t lseek();
122 #endif /* !__MSDOS__ */
123 char *getcwd();
124 #endif /* !_POSIX_VERSION */
125
126 #ifndef NULL
127 #define NULL 0
128 #endif
129
130 #ifndef O_BINARY
131 #define O_BINARY 0
132 #endif
133 #ifndef O_CREAT
134 #define O_CREAT 0
135 #endif
136 #ifndef O_NDELAY
137 #define O_NDELAY 0
138 #endif
139 #ifndef O_RDONLY
140 #define O_RDONLY 0
141 #endif
142 #ifndef O_RDWR
143 #define O_RDWR 2
144 #endif
145
146 #include <sys/stat.h>
147 #ifndef S_ISREG /* Doesn't have POSIX.1 stat stuff. */
148 #define mode_t unsigned short
149 #endif
150 #if !defined(S_ISBLK) && defined(S_IFBLK)
151 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
152 #endif
153 #if !defined(S_ISCHR) && defined(S_IFCHR)
154 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
155 #endif
156 #if !defined(S_ISDIR) && defined(S_IFDIR)
157 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
158 #endif
159 #if !defined(S_ISREG) && defined(S_IFREG)
160 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
161 #endif
162 #if !defined(S_ISFIFO) && defined(S_IFIFO)
163 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
164 #define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
165 #endif
166 #if !defined(S_ISLNK) && defined(S_IFLNK)
167 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
168 #endif
169 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
170 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
171 #endif
172 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
173 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
174 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
175 #endif
176 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
177 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
178 #endif
179 #if !defined(S_ISCTG) && defined(S_IFCTG) /* contiguous file */
180 #define S_ISCTG(m) (((m) & S_IFMT) == S_IFCTG)
181 #endif
182 #if !defined(S_ISVTX)
183 #define S_ISVTX 0001000
184 #endif
This page took 0.042694 seconds and 4 git commands to generate.