2935
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
2935
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_syswait_h) |
|
25 #define octave_syswait_h 1 |
|
26 |
|
27 // This mess suggested by the autoconf manual. |
|
28 |
|
29 #ifdef HAVE_SYS_TYPES_H |
|
30 #include <sys/types.h> |
|
31 #endif |
|
32 |
|
33 #if defined (NeXT) && ! defined (_POSIX_SOURCE) |
|
34 #define HAVE_SYS_WAIT_H |
|
35 #endif |
|
36 |
|
37 #if defined HAVE_SYS_WAIT_H |
|
38 #include <sys/wait.h> |
|
39 #endif |
|
40 |
|
41 #if defined (NeXT) |
|
42 #define HAVE_WAITPID 1 |
|
43 #define waitpid(a, b, c) \ |
|
44 wait4 ((a) == -1 ? 0 : (a), (union wait *)(b), c, 0) |
|
45 |
|
46 // Use the defaults below |
|
47 #undef WIFEXITED |
|
48 #undef WEXITSTATUS |
|
49 #undef WIFSIGNALLED |
|
50 #endif |
|
51 |
|
52 // NeXT has sys/wait.h, but it is not compatible with POSIX.1, so we |
|
53 // try to define waitpid in terms of wait4. |
|
54 |
|
55 #if defined (NeXT) |
|
56 #include <sys/wait.h> |
|
57 #define waitpid(a, b, c) \ |
|
58 wait4 ((a) == -1 ? 0 : (a), (union wait *)(b), c, 0) |
|
59 #endif |
|
60 |
|
61 #ifndef WIFEXITED |
|
62 #define WIFEXITED(stat_val) (((stat_val) & 255) == 0) |
|
63 #endif |
|
64 |
|
65 #ifndef WEXITSTATUS |
|
66 #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) |
|
67 #endif |
|
68 |
|
69 #ifndef WIFSIGNALLED |
|
70 #define WIFSIGNALLED(stat_val) \ |
|
71 (((stat_val) & 0177) != 0177 && ((stat_val) & 0177) != 0) |
|
72 #endif |
|
73 |
|
74 #endif |
|
75 |
|
76 /* |
|
77 ;;; Local Variables: *** |
|
78 ;;; mode: C++ *** |
|
79 ;;; End: *** |
|
80 */ |