]> git.saurik.com Git - apt.git/blame_incremental - test/mthdcat.cc
* apt-pkg/contrib/fileutl.cc:
[apt.git] / test / mthdcat.cc
... / ...
CommitLineData
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}