Mercurial > octave-nkf
comparison src/mkoctfile.in.cc @ 18906:4586051a5ff1
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 | 5b7b18d603ae |
children | c4def7ab39e7 |
comparison
equal
deleted
inserted
replaced
18902:2b82d2f29a7b | 18906:4586051a5ff1 |
---|---|
34 #include <fstream> | 34 #include <fstream> |
35 #include <vector> | 35 #include <vector> |
36 #include <cstdlib> | 36 #include <cstdlib> |
37 | 37 |
38 #include <unistd.h> | 38 #include <unistd.h> |
39 | |
40 // This mess suggested by the autoconf manual. | |
41 | |
42 #include <sys/types.h> | |
43 | |
44 #if defined HAVE_SYS_WAIT_H | |
45 #include <sys/wait.h> | |
46 #endif | |
47 | |
48 #ifndef WIFEXITED | |
49 #define WIFEXITED(stat_val) (((stat_val) & 255) == 0) | |
50 #endif | |
51 | |
52 #ifndef WEXITSTATUS | |
53 #define WEXITSTATUS(stat_val) (static_cast<unsigned> (stat_val) >> 8) | |
54 #endif | |
39 | 55 |
40 static std::map<std::string, std::string> vars; | 56 static std::map<std::string, std::string> vars; |
41 | 57 |
42 #ifndef OCTAVE_VERSION | 58 #ifndef OCTAVE_VERSION |
43 #define OCTAVE_VERSION %OCTAVE_CONF_VERSION% | 59 #define OCTAVE_VERSION %OCTAVE_CONF_VERSION% |
342 static int | 358 static int |
343 run_command (const std::string& cmd) | 359 run_command (const std::string& cmd) |
344 { | 360 { |
345 if (debug) | 361 if (debug) |
346 std::cout << cmd << std::endl; | 362 std::cout << cmd << std::endl; |
363 | |
347 int result = system (cmd.c_str ()); | 364 int result = system (cmd.c_str ()); |
365 | |
348 if (WIFEXITED (result)) | 366 if (WIFEXITED (result)) |
349 result = WEXITSTATUS (result); | 367 result = WEXITSTATUS (result); |
368 | |
350 return result; | 369 return result; |
351 } | 370 } |
352 | 371 |
353 bool | 372 bool |
354 is_true (const std::string& s) | 373 is_true (const std::string& s) |