- fprintf(stderr, "install: read: %s: %s\n", from_name, sys_errlist[errno]);
+ PERROR("install: read: ", from_name);
+ bad();
+ }
+ }
+ else {
+ (void)lseek(from_fd, 0L, L_SET);
+ copy(from_fd, from_name, to_fd, to_name);
+ }
+}
+
+/*
+ * copy --
+ * copy from one file to another
+ */
+copy(from_fd, from_name, to_fd, to_name)
+ register int from_fd, to_fd;
+ char *from_name, *to_name;
+{
+ register int n;
+ char buf[MAXBSIZE];
+
+ while ((n = read(from_fd, buf, sizeof(buf))) > 0)
+ if (write(to_fd, buf, n) != n) {
+ PERROR("install: write: ", to_name);