diff options
Diffstat (limited to 'lib/InPipe.cc')
-rw-r--r-- | lib/InPipe.cc | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/lib/InPipe.cc b/lib/InPipe.cc index efcab10..fcbd1c6 100644 --- a/lib/InPipe.cc +++ b/lib/InPipe.cc @@ -1,42 +1,42 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "InPipe.h" -#include "Output.h" -#include "gettext.h" - -InPipe::InPipe() : Handle(pipe(p, 0)), hooked(0) { -} - -InPipe::InPipe(const InPipe & i) : Handle(i), hooked(i.hooked) { - p[0] = GetHandle(); - p[1] = dup(i.p[1]); -} - -InPipe::~InPipe() { - if (hooked) { - ::close(1); - dup(Stdout.GetHandle()); - } -} - -void InPipe::Hook() { - if (!hooked) { - hooked = 1; - ::close(1); - dup(p[1]); - ::close(p[1]); - } -} - -bool InPipe::CanWrite() { - return false; -} - -bool InPipe::CanRead() { - return true; -} - -String InPipe::GetName() { - return (String(_("Input pipe from stdout (")) + (hooked ? "" : _("not ")) + _("hooked)")); -} +#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "InPipe.h"
+#include "Output.h"
+#include "gettext.h"
+
+InPipe::InPipe() : Handle(pipe(p, 0)), hooked(0) {
+}
+
+InPipe::InPipe(const InPipe & i) : Handle(i), hooked(i.hooked) {
+ p[0] = GetHandle();
+ p[1] = dup(i.p[1]);
+}
+
+InPipe::~InPipe() {
+ if (hooked) {
+ ::close(1);
+ dup(Stdout.GetHandle());
+ }
+}
+
+void InPipe::Hook() {
+ if (!hooked) {
+ hooked = 1;
+ ::close(1);
+ dup(p[1]);
+ ::close(p[1]);
+ }
+}
+
+bool InPipe::CanWrite() {
+ return false;
+}
+
+bool InPipe::CanRead() {
+ return true;
+}
+
+String InPipe::GetName() {
+ return (String(_("Input pipe from stdout (")) + (hooked ? "" : _("not ")) + _("hooked)"));
+}
|