# HG changeset patch # User John W. Eaton # Date 1403903368 14400 # Node ID 5999e654f2564cbbb8244e63fd72c3ebf71935c7 # Parent 3e4e2cfba18640eee534ab902868acc485486c80 WIFEXITED and WEXITSTATUS macros for mkoctfile.cc * mkoctfile.in.cc (WIFEXITED, WEXITSTATUS): Define for systems that don't have these macros. diff -r 3e4e2cfba186 -r 5999e654f256 src/mkoctfile.in.cc --- a/src/mkoctfile.in.cc Sun Jul 13 20:43:25 2014 -0700 +++ b/src/mkoctfile.in.cc Fri Jun 27 17:09:28 2014 -0400 @@ -37,6 +37,22 @@ #include +// This mess suggested by the autoconf manual. + +#include + +#if defined HAVE_SYS_WAIT_H +#include +#endif + +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) (static_cast (stat_val) >> 8) +#endif + static std::map 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