From 851b6a097165af4d51c0db01b5e05256e5006896 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:00:48 +0200 Subject: Adding upstream version 2.6.1. Signed-off-by: Daniel Baumann --- test/interactive-helper/mthdcat.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/interactive-helper/mthdcat.cc (limited to 'test/interactive-helper/mthdcat.cc') diff --git a/test/interactive-helper/mthdcat.cc b/test/interactive-helper/mthdcat.cc new file mode 100644 index 0000000..2961b20 --- /dev/null +++ b/test/interactive-helper/mthdcat.cc @@ -0,0 +1,22 @@ +/* Usage, mthdcat < cmds | methods/mthd + All this does is cat a file into the method without closing the FD when + the file ends */ + +#include + +#include + +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; +} -- cgit v1.2.3