summaryrefslogtreecommitdiff
path: root/test/interactive-helper/mthdcat.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-09-13 18:00:22 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-09-13 18:00:22 +0200
commitafd7b358f94efddb83a2911ec1a21e7280074b1e (patch)
treefaa658f29d7dff42c6ed475037dd462384eab46e /test/interactive-helper/mthdcat.cc
parent74b220028595342028e3309002e4ec359af328f9 (diff)
parent4e9108b8238438f1c390cb9ea9de598de1b7d7cb (diff)
merge with debian/sid
Diffstat (limited to 'test/interactive-helper/mthdcat.cc')
-rw-r--r--test/interactive-helper/mthdcat.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/interactive-helper/mthdcat.cc b/test/interactive-helper/mthdcat.cc
new file mode 100644
index 000000000..25d09a3f5
--- /dev/null
+++ b/test/interactive-helper/mthdcat.cc
@@ -0,0 +1,20 @@
+/* Usage, mthdcat < cmds | methods/mthd
+ All this does is cat a file into the method without closing the FD when
+ the file ends */
+
+#include <unistd.h>
+
+int main()
+{
+ char Buffer[4096];
+
+ while (1)
+ {
+ int Res = read(STDIN_FILENO,Buffer,sizeof(Buffer));
+ if (Res <= 0)
+ while (1) sleep(100);
+ if (write(STDOUT_FILENO,Buffer,Res) != Res)
+ break;
+ }
+ return 0;
+}