]>
Dogcows Code - chaz/tar/blob - src/port.h
1 /* Portability declarations. Requires sys/types.h.
2 Copyright (C) 1988, 1992 Free Software Foundation
4 This file is part of GNU Tar.
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)
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.
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. */
20 /* AIX requires this to be the first thing in the file. */
22 #define alloca __builtin_alloca
23 #else /* not __GNUC__ */
26 #else /* not HAVE_ALLOCA_H */
32 #endif /* not HAVE_ALLOCA_H */
33 #endif /* not __GNUC__ */
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)
44 #define WSTOPSIG(w) (((w) >> 8) & 0xff)
45 #define WTERMSIG(w) ((w) & 0x7f)
46 #define WEXITSTATUS(w) (((w) >> 8) & 0xff)
47 #endif /* _POSIX_VERSION */
51 #define WIFCOREDUMPED(w) (((w) & 0x80) != 0)
55 /* missing things from sys/stat.h */
61 #define makedev(ma, mi) ((ma << 8) | mi)
62 #define major(dev) (dev)
63 #define minor(dev) (dev)
65 #endif /* __MSDOS__ */
67 #if defined(__STDC__) || defined(__TURBOC__)
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. */
79 #if !defined(HAVE_MAJOR) && defined(MAJOR_IN_MKDEV)
80 #include <sys/mkdev.h>
84 #if !defined(HAVE_MAJOR) && defined(MAJOR_IN_SYSMACROS)
85 #include <sys/sysmacros.h>
90 #define major(dev) (((dev) >> 8) & 0xff)
91 #define minor(dev) ((dev) & 0xff)
92 #define makedev(maj, min) (((maj) << 8) | (min))
96 #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
98 #if !defined(__MSDOS__) && !defined(STDC_HEADERS)
108 #define rindex strrchr
109 #define bcopy(s, d, n) memcpy(d, s, n)
110 #define bzero(s, n) memset(s, 0, n)
116 #if defined(STDC_HEADERS)
119 char *malloc (), *realloc ();
123 #ifndef _POSIX_VERSION
126 #else /* !__MSDOS__ */
128 #endif /* !__MSDOS__ */
130 #endif /* !_POSIX_VERSION */
152 #include <sys/stat.h>
153 #ifndef S_ISREG /* Doesn't have POSIX.1 stat stuff. */
154 #define mode_t unsigned short
156 #if !defined(S_ISBLK) && defined(S_IFBLK)
157 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
159 #if !defined(S_ISCHR) && defined(S_IFCHR)
160 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
162 #if !defined(S_ISDIR) && defined(S_IFDIR)
163 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
165 #if !defined(S_ISREG) && defined(S_IFREG)
166 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
168 #if !defined(S_ISFIFO) && defined(S_IFIFO)
169 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
170 #define mkfifo(path, mode) (mknod ((path), (mode) | S_IFIFO, 0))
172 #if !defined(S_ISLNK) && defined(S_IFLNK)
173 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
175 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
176 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
178 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
179 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
180 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
182 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
183 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
185 #if !defined(S_ISCTG) && defined(S_IFCTG) /* contiguous file */
186 #define S_ISCTG(m) (((m) & S_IFMT) == S_IFCTG)
188 #if !defined(S_ISVTX)
189 #define S_ISVTX 0001000
194 #define NLENGTH(direct) ((direct)->d_namlen)
196 #else /* not __MSDOS__ */
198 #if defined(DIRENT) || defined(_POSIX_VERSION)
200 #define NLENGTH(direct) (strlen((direct)->d_name))
201 #else /* not (DIRENT or _POSIX_VERSION) */
202 #define dirent direct
203 #define NLENGTH(direct) ((direct)->d_namlen)
205 #include <sys/ndir.h>
213 #endif /* DIRENT or _POSIX_VERSION */
215 #endif /* not __MSDOS__ */
This page took 0.043129 seconds and 4 git commands to generate.