os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/win/cat.c
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
 * cat.c --
sl@0
     3
 *
sl@0
     4
 *	Program used when testing tclWinPipe.c
sl@0
     5
 *
sl@0
     6
 * Copyright (c) 1996 by Sun Microsystems, Inc.
sl@0
     7
 *
sl@0
     8
 * See the file "license.terms" for information on usage and redistribution
sl@0
     9
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
sl@0
    10
 *
sl@0
    11
 * RCS: @(#) $Id: cat.c,v 1.2 1998/09/14 18:40:19 stanton Exp $
sl@0
    12
 */
sl@0
    13
sl@0
    14
#include <stdio.h>
sl@0
    15
#include <io.h>
sl@0
    16
#include <string.h>
sl@0
    17
sl@0
    18
int
sl@0
    19
main()
sl@0
    20
{   
sl@0
    21
    char buf[1024];
sl@0
    22
    int n;
sl@0
    23
    char *err;
sl@0
    24
sl@0
    25
    while (1) {
sl@0
    26
	n = read(0, buf, sizeof(buf));
sl@0
    27
	if (n <= 0) {
sl@0
    28
	    break;
sl@0
    29
	}
sl@0
    30
        write(1, buf, n);
sl@0
    31
    }
sl@0
    32
    err = (sizeof(int) == 2) ? "stderr16" : "stderr32";
sl@0
    33
    write(2, err, strlen(err));
sl@0
    34
sl@0
    35
    return 0;
sl@0
    36
}
sl@0
    37