/*
============================================================================
Name : test.c
Author : blank
Version :
Copyright : Your copyright notice
Description : 程序3-3 将标准输入复制到标准输出
============================================================================
*/
#include <stdio.h>
#include <unistd.h>
#include "ourhdr.h"
#define BUFFSIZE 4096
int main(int argc, char *argv[])
{
char buf[BUFFSIZE];
int n;
while((n = read(STDIN_FILENO, buf, BUFFSIZE)) > 0){
if ((n = write(STDOUT_FILENO, buf, n)) != n){
err_sys("write to STDOUT_FILENO error\n");
}
}
if (n < 0){
err_sys("read from STDIN_FILENO error\n");
}
exit(0);
}