#include "exception.hxx"
-// ATTENTION: A lot of mysterious STL bugs occured
-// with a "real" buffer (buffer larger than 1 byte and up to 100 bytes)
-// -> Keep it slow and working!
-
+/** @brief runs command and provides buffered input for it through pipe
+ *
+ * opens pipe to command using popen; exit status available after destruction
+ * (use WEXITSTATUS to get the "regular" return code (lowest byte))
+ *
+ * ATTENTION: A lot of mysterious STL bugs occured
+ * with a "real" buffer (buffer larger than 1 byte and up to 100 bytes)
+ * -> Keep it slow and working!
+ */
class inpipebuf : public std::streambuf
{
protected:
}
}
+ /** note: exit status only available after destruction */
void store_exit_status(bool *_status_set, int *_exit_status)
{ status_set = _status_set; exit_status = _exit_status; }
}
};
+/** @brief stream around inpipebuf -- see comment there */
class inpipestream : public std::istream
{
protected:
{ buf.store_exit_status(_status_set, _exit_status); }
};
+
+/** @brief runs command and provides buffered ouptput from it through pipe
+ *
+ * opens pipe to command using popen; exit status available after destruction
+ * (use WEXITSTATUS to get the "regular" return code (lowest byte))
+ */
class outpipebuf : public std::streambuf
{
protected:
}
}
+ /** note: exit status only available after destruction */
void store_exit_status(bool *_status_set, int *_exit_status)
{ status_set = _status_set; exit_status = _exit_status; }
}
};
+
+/** @brief stream around outpipebuf -- see comment there */
class outpipestream : public std::ostream
{
protected: