| 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.2 1998/09/14 18:40:19 stanton Exp $ |
| 12 | */ |
| 13 | |
| 14 | #include <stdio.h> |
| 15 | #include <io.h> |
| 16 | #include <string.h> |
| 17 | |
| 18 | int |
| 19 | main() |
| 20 | { |
| 21 | char buf[1024]; |
| 22 | int n; |
| 23 | char *err; |
| 24 | |
| 25 | while (1) { |
| 26 | n = read(0, buf, sizeof(buf)); |
| 27 | if (n <= 0) { |
| 28 | break; |
| 29 | } |
| 30 | write(1, buf, n); |
| 31 | } |
| 32 | err = (sizeof(int) == 2) ? "stderr16" : "stderr32"; |
| 33 | write(2, err, strlen(err)); |
| 34 | |
| 35 | return 0; |
| 36 | } |
| 37 |