version 1.2, 1995/12/21 14:47:09 |
version 1.3, 1996/06/26 05:44:05 |
|
|
|
/* $OpenBSD$ */ |
/* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */ |
/* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */ |
|
|
/* |
/* |
|
|
#if 0 |
#if 0 |
static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; |
static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93"; |
#endif |
#endif |
static char rcsid[] = "$NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $"; |
static char rcsid[] = "$OpenBSD$"; |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#include <sys/param.h> |
#include <sys/param.h> |
|
|
register int nr, nw; |
register int nr, nw; |
int serrno; |
int serrno; |
char *p, buf[MAXBSIZE]; |
char *p, buf[MAXBSIZE]; |
|
volatile size_t siz; |
|
|
/* |
/* |
* Mmap and write if less than 8M (the limit is so we don't totally |
* Mmap and write if less than 8M (the limit is so we don't totally |
|
|
if ((p = mmap(NULL, (size_t)size, PROT_READ, |
if ((p = mmap(NULL, (size_t)size, PROT_READ, |
0, from_fd, (off_t)0)) == (char *)-1) |
0, from_fd, (off_t)0)) == (char *)-1) |
err(1, "%s", from_name); |
err(1, "%s", from_name); |
if (write(to_fd, p, size) != size) |
siz = (size_t)size; |
|
if (write(to_fd, p, siz) != siz) |
err(1, "%s", to_name); |
err(1, "%s", to_name); |
} else { |
} else { |
while ((nr = read(from_fd, buf, sizeof(buf))) > 0) |
while ((nr = read(from_fd, buf, sizeof(buf))) > 0) |