1 /* 2 * cat.c -- 3 * 4 * Program used when testing tclWinPipe.c 5 * 6 * Copyright (c) 1996 by Sun Microsystems, Inc. 7 * 8 * See the file "license.terms" for information on usage and redistribution 9 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 10 */ 11 12 #include <stdio.h> 13 #include <io.h> 14 #include <string.h> 15 16 int main(void)17main(void) 18 { 19 char buf[1024]; 20 int n; 21 const char *err; 22 23 while (1) { 24 n = read(0, buf, sizeof(buf)); 25 if (n <= 0) { 26 break; 27 } 28 write(1, buf, n); 29 } 30 err = (sizeof(int) == 2) ? "stderr16" : "stderr32"; 31 write(2, err, strlen(err)); 32 33 return 0; 34 } 35