Mercurial > hg > octave-nkf
changeset 19106:5999e654f256 stable
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
* mkoctfile.in.cc (WIFEXITED, WEXITSTATUS): Define for systems that
don't have these macros.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 27 Jun 2014 17:09:28 -0400 |
parents | 3e4e2cfba186 |
children | f6468b8c6a74 2c1e8de41649 |
files | src/mkoctfile.in.cc |
diffstat | 1 files changed, 23 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mkoctfile.in.cc +++ b/src/mkoctfile.in.cc @@ -37,6 +37,22 @@ #include <unistd.h> +// This mess suggested by the autoconf manual. + +#include <sys/types.h> + +#if defined HAVE_SYS_WAIT_H +#include <sys/wait.h> +#endif + +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) (static_cast<unsigned> (stat_val) >> 8) +#endif + static std::map<std::string, std::string> vars; #ifndef OCTAVE_VERSION @@ -344,7 +360,13 @@ { if (debug) std::cout << cmd << std::endl; - return system (cmd.c_str ()); + + int result = system (cmd.c_str ()); + + if (WIFEXITED (result)) + result = WEXITSTATUS (result); + + return result; } bool