]> git.saurik.com Git - apt.git/blob - test/mthdcat.cc
methods/gzip.cc: With FileFd now being able to read gzipped files, there
[apt.git] / test / 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 <unistd.h>
6
7 int 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 }