]> git.saurik.com Git - apt.git/blame - test/interactive-helper/mthdcat.cc
Merge branch 'debian/sid' into debian/experimental
[apt.git] / test / interactive-helper / mthdcat.cc
CommitLineData
8bb5959b
AL
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 <unistd.h>
6
7int main()
8{
9 char Buffer[4096];
10
11 while (1)
12 {
13 int Res = read(STDIN_FILENO,Buffer,sizeof(Buffer));
14 if (Res <= 0)
15 while (1) sleep(100);
16 if (write(STDOUT_FILENO,Buffer,Res) != Res)
17 break;
18 }
19 return 0;
20}