home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / linux / backup / star-1.3.1.tar.gz / star-1.3.1.tar / star-1.3.1 / include / waitdefs.h < prev    next >
C/C++ Source or Header  |  2000-11-08  |  2KB  |  104 lines

  1. /* @(#)waitdefs.h    1.8 00/11/08 Copyright 1995 J. Schilling */
  2. /*
  3.  *    Definitions to deal with various kinds of wait flavour
  4.  *
  5.  *    Copyright (c) 1995 J. Schilling
  6.  */
  7. /*
  8.  * This program is free software; you can redistribute it and/or modify
  9.  * it under the terms of the GNU General Public License as published by
  10.  * the Free Software Foundation; either version 2, or (at your option)
  11.  * any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  * GNU General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; see the file COPYING.  If not, write to
  20.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23. #ifndef    _WAITDEFS_H
  24. #define    _WAITDEFS_H
  25.  
  26. #ifndef _MCONFIG_H
  27. #include <mconfig.h>
  28. #endif
  29.  
  30. #if    defined(HAVE_WAIT_H)
  31. #    include <wait.h>
  32. #else
  33. /*
  34.  * K&R Compiler doesn't like #elif
  35.  */
  36. #    if    defined(HAVE_SYS_WAIT_H)    /* POSIX.1 compat sys/wait.h */
  37. #    undef    HAVE_UNION_WAIT            /* POSIX.1 doesn't use U_W   */
  38. #        include <sys/wait.h>
  39. #    endif
  40. #endif
  41.  
  42. #ifdef    __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46. #ifdef HAVE_UNION_WAIT
  47. #    define WAIT_T union wait
  48. #    ifndef WTERMSIG
  49. #        define WTERMSIG(status)        ((status).w_termsig)
  50. #    endif
  51. #    ifndef WCOREDUMP
  52. #        define WCOREDUMP(status)    ((status).w_coredump)
  53. #    endif
  54. #    ifndef WEXITSTATUS
  55. #        define WEXITSTATUS(status)    ((status).w_retcode)
  56. #    endif
  57. #    ifndef WSTOPSIG
  58. #        define WSTOPSIG(status)        ((status).w_stopsig)
  59. #    endif
  60. #else
  61. #    define WAIT_T int
  62. #    ifndef WTERMSIG
  63. #        define WTERMSIG(status)        ((status) & 0x7F)
  64. #    endif
  65. #    ifndef WCOREDUMP
  66. #        define WCOREDUMP(status)    ((status) & 0x80)
  67. #    endif
  68. #    ifndef WEXITSTATUS
  69. #        define WEXITSTATUS(status)    (((status) >> 8) & 0xFF)
  70. #    endif
  71. #    ifndef WSTOPSIG
  72. #        define WSTOPSIG(status)        (((status) >> 8) & 0xFF)
  73. #    endif
  74. #endif
  75.  
  76. #ifndef WIFSTOPPED
  77. #    define    WIFSTOPPED(status)    (((status) & 0xFF) == 0x7F)
  78. #endif
  79. #ifndef WIFSIGNALED
  80. #    define    WIFSIGNALED(status)    (((status) & 0xFF) != 0x7F && \
  81.                         WTERMSIG(status) != 0)
  82. #endif
  83. #ifndef WIFEXITED
  84. #    define    WIFEXITED(status)    (((status) & 0xFF) == 0)
  85. #endif
  86.  
  87. #ifndef    WCOREFLG
  88. #define    WCOREFLG    0x80
  89. #endif
  90.  
  91. #ifndef    WSTOPFLG
  92. #define    WSTOPFLG    0x7F
  93. #endif
  94.  
  95. #ifndef    WCONTFLG
  96. #define    WCONTFLG    0xFFFF
  97. #endif
  98.  
  99. #ifdef    __cplusplus
  100. }
  101. #endif
  102.  
  103. #endif    /* _WAITDEFS_H */
  104.