summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/print_stdin.c
blob: 76b3a8484e2b798d8911183e1c9d48877ee2cfe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>

int main(void)
{
  char buf[1024];
  size_t nIn = sizeof(buf);
  while (nIn == sizeof(buf)) {
    nIn = fread(buf, 1, sizeof(buf), stdin);
    if (nIn > 0) {
      size_t nOut;
      nOut = fwrite(buf, 1, nIn, stdout);
      if (nOut != nIn) {
        return 1;
      }
    }
  }
  return 0;
}