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 * RCS: @(#) $Id: cat.c,v 1.3.10.1 2010/01/31 23:51:37 nijtmans Exp $ 12 */ 13 14#include <stdio.h> 15#ifdef __CYGWIN__ 16# include <unistd.h> 17#else 18# include <io.h> 19#endif 20#include <string.h> 21 22int 23main(void) 24{ 25 char buf[1024]; 26 int n; 27 const char *err; 28 29 while (1) { 30 n = read(0, buf, sizeof(buf)); 31 if (n <= 0) { 32 break; 33 } 34 write(1, buf, n); 35 } 36 err = (sizeof(int) == 2) ? "stderr16" : "stderr32"; 37 write(2, err, strlen(err)); 38 39 return 0; 40} 41