Hook up ascii.tmac for the tool build as well.
[netbsd-mini2440.git] / bin / ksh / ksh_wait.h
blobfae8dd7c1ad1d571f5864b95ecfabe93e0ee5f0c
1 /* $NetBSD$ */
3 /* Wrapper around the ugly sys/wait includes/ifdefs */
4 /* $NetBSD: ksh_wait.h,v 1.1.1.1 1996/09/21 23:35:15 jtc Exp $ */
6 #ifdef HAVE_SYS_WAIT_H
7 # include <sys/wait.h>
8 #endif
10 #ifndef POSIX_SYS_WAIT
11 /* Get rid of system macros (which probably use union wait) */
12 # undef WIFCORED
13 # undef WIFEXITED
14 # undef WEXITSTATUS
15 # undef WIFSIGNALED
16 # undef WTERMSIG
17 # undef WIFSTOPPED
18 # undef WSTOPSIG
19 #endif /* POSIX_SYS_WAIT */
21 typedef int WAIT_T;
23 #ifndef WIFCORED
24 # define WIFCORED(s) ((s) & 0x80)
25 #endif
26 #define WSTATUS(s) (s)
28 #ifndef WIFEXITED
29 # define WIFEXITED(s) (((s) & 0xff) == 0)
30 #endif
31 #ifndef WEXITSTATUS
32 # define WEXITSTATUS(s) (((s) >> 8) & 0xff)
33 #endif
34 #ifndef WIFSIGNALED
35 # define WIFSIGNALED(s) (((s) & 0xff) != 0 && ((s) & 0xff) != 0x7f)
36 #endif
37 #ifndef WTERMSIG
38 # define WTERMSIG(s) ((s) & 0x7f)
39 #endif
40 #ifndef WIFSTOPPED
41 # define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
42 #endif
43 #ifndef WSTOPSIG
44 # define WSTOPSIG(s) (((s) >> 8) & 0xff)
45 #endif
47 #if !defined(HAVE_WAITPID) && defined(HAVE_WAIT3)
48 /* always used with p == -1 */
49 # define ksh_waitpid(p, s, o) wait3((s), (o), (struct rusage *) 0)
50 #else /* !HAVE_WAITPID && HAVE_WAIT3 */
51 # define ksh_waitpid(p, s, o) waitpid((p), (s), (o))
52 #endif /* !HAVE_WAITPID && HAVE_WAIT3 */