2935
|
1 /* |
|
2 |
7017
|
3 Copyright (C) 1996, 1997, 2005, 2006, 2007 John W. Eaton |
2935
|
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 |
7016
|
9 Free Software Foundation; either version 3 of the License, or (at your |
|
10 option) any later version. |
2935
|
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 |
7016
|
18 along with Octave; see the file COPYING. If not, see |
|
19 <http://www.gnu.org/licenses/>. |
2935
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_syswait_h) |
|
24 #define octave_syswait_h 1 |
|
25 |
5453
|
26 #ifdef __cplusplus |
|
27 extern "C" { |
|
28 #endif |
|
29 |
|
30 /* This mess suggested by the autoconf manual. */ |
2935
|
31 |
|
32 #include <sys/types.h> |
|
33 |
|
34 #if defined HAVE_SYS_WAIT_H |
|
35 #include <sys/wait.h> |
|
36 #endif |
|
37 |
|
38 #ifndef WIFEXITED |
|
39 #define WIFEXITED(stat_val) (((stat_val) & 255) == 0) |
|
40 #endif |
|
41 |
|
42 #ifndef WEXITSTATUS |
|
43 #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) |
|
44 #endif |
|
45 |
|
46 #ifndef WIFSIGNALLED |
|
47 #define WIFSIGNALLED(stat_val) \ |
|
48 (((stat_val) & 0177) != 0177 && ((stat_val) & 0177) != 0) |
|
49 #endif |
|
50 |
6096
|
51 #if defined (__MINGW32__) || defined (_MSC_VER) |
5453
|
52 #define HAVE_WAITPID 1 |
|
53 #include <process.h> |
|
54 #define WAITPID(a, b, c) _cwait (b, a, c) |
|
55 /* Action argument is ignored for _cwait, so arbitrary definition. */ |
|
56 #define WNOHANG 0 |
|
57 #else |
|
58 #define WAITPID(a, b, c) waitpid (a, b, c) |
|
59 #endif |
|
60 |
|
61 #ifdef __cplusplus |
|
62 } |
|
63 #endif |
|
64 |
2935
|
65 #endif |