aboutsummaryrefslogblamecommitdiff
path: root/8.1/filecopy.c
blob: b35ccbd99b5c477a64a2280d49ec6b9ec6763df9 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                  
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "filecopy.h"
#include "error.h"

void filecopy(int ifd, int ofd)
{
	ssize_t n;
	char buff[BUFSIZ];

	while ((n = read(ifd, buff, BUFSIZ)) > 0)
		if (write(ofd, buff, n) != n)
			error("cat: write error");
}