middle of porting; unstable, don't checkout; refs #1

This commit is contained in:
Marc Wäckerlin
2011-12-10 10:15:28 +00:00
parent 232b7425f1
commit 4357fe3d9f
31 changed files with 1465 additions and 109 deletions

View File

@@ -17,6 +17,7 @@
#include <unistd.h> // close
#include <stdexcept>
#include <cassert>
#include <cstdlib> // free
// forward
class bfd;

View File

@@ -62,6 +62,7 @@
#include <assert.h> // assert
#include <sys/types.h> // kill
#include <signal.h> // kill
#include <cstdlib> // exit
//=========================================================== ExecutionFailedExc
@@ -246,11 +247,13 @@ mrw::Exec& mrw::Exec::execute(bool exc) throw(std::exception) {
//------------------------------------------------------------------------------
mrw::Exec& mrw::Exec::execute(const std::string& input, bool exc)
throw(std::exception) {
#ifdef SSIZE_MAX
/// @c input length must be smaller than @c SSIZE_MAX.
/// I'll only add support for longer strings upon request.
assert(input.size()<=SSIZE_MAX &&
"sdin input exeeds C library limit in mrw::Exec "
"please contact the author of the library");
#endif
/** This method calls @c fork, sets up a pipe connection to pass @c
stdin, @c stdout and @c stderr between the child process and the
parent process using mrw::Pipe and calls @c execvp to execute
@@ -471,11 +474,13 @@ std::pair<std::string, std::string>
mrw::PartialExec::read(const std::string& input, bool exc)
throw(std::exception) {
std::pair<std::string, std::string> output;
#ifdef SSIZE_MAX
/** @note @c input length must be smaller than @c SSIZE_MAX.
I'll only add support for longer strings upon request. */
assert(input.size()<=SSIZE_MAX &&
"sdin input exeeds C library limit in mrw::Exec "
"please contact the author of the library");
#endif
/** @warning After calling finish(), it is forbidden to pass
any @c input string, it must then always be empty,
because the pipe is already closed! */

View File

@@ -43,6 +43,7 @@
#include <string>
#include <list>
#include <memory>
#include <mrw/exception.hpp>
#include <mrw/unistd.hpp>

View File

@@ -37,6 +37,8 @@
#include <fstream>
#include <sys/types.h>
#include <dirent.h>
#include <cstddef> // offsetof
#include <cstdlib> // abort
namespace mrw {