OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/base.git] / util / src / TclTk / tcl8.6.12 / win / cat.c
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 #ifdef TCL_BROKEN_MAINARGS
13 /* On mingw32 and cygwin this doesn't work */
14 #   undef UNICODE
15 #   undef _UNICODE
16 #endif
17
18 #include <stdio.h>
19 #include <io.h>
20 #include <string.h>
21 #include <tchar.h>
22
23 int
24 _tmain(void)
25 {
26     char buf[1024];
27     int n;
28     const char *err;
29
30     while (1) {
31         n = _read(0, buf, sizeof(buf));
32         if (n <= 0) {
33             break;
34         }
35         _write(1, buf, n);
36     }
37     err = (sizeof(int) == 2) ? "stderr16" : "stderr32";
38     _write(2, err, (unsigned int)strlen(err));
39
40     return 0;
41 }