]> git.saurik.com Git - apt.git/blob - test/interactive-helper/mthdcat.cc
Merge remote-tracking branch 'donkult/debian/experimental' into debian/experimental
[apt.git] / test / interactive-helper / mthdcat.cc
1 /* Usage, mthdcat < cmds | methods/mthd
2 All this does is cat a file into the method without closing the FD when
3 the file ends */
4
5 #include <config.h>
6
7 #include <unistd.h>
8
9 int main()
10 {
11 char Buffer[4096];
12
13 while (1)
14 {
15 int Res = read(STDIN_FILENO,Buffer,sizeof(Buffer));
16 if (Res <= 0)
17 while (1) sleep(100);
18 if (write(STDOUT_FILENO,Buffer,Res) != Res)
19 break;
20 }
21 return 0;
22 }