mthdcat.cc 416 B

1234567891011121314151617181920212223
  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. #include <config.h>
  5. #include <unistd.h>
  6. int main()
  7. {
  8. char Buffer[4096];
  9. while (1)
  10. {
  11. int Res = read(STDIN_FILENO,Buffer,sizeof(Buffer));
  12. if (Res <= 0)
  13. while (1) sleep(100);
  14. if (write(STDOUT_FILENO,Buffer,Res) != Res)
  15. break;
  16. }
  17. return 0;
  18. }