1*85fb39b8Ssam /* copy.c 4.1 83/02/13 */ 2*85fb39b8Ssam 3*85fb39b8Ssam /* 4*85fb39b8Ssam * Copy from to in 10K units. 5*85fb39b8Ssam * Intended for use in system 6*85fb39b8Ssam * installation. 7*85fb39b8Ssam */ 8*85fb39b8Ssam main() 9*85fb39b8Ssam { 10*85fb39b8Ssam int from, to; 11*85fb39b8Ssam char fbuf[50], tbuf[50]; 12*85fb39b8Ssam char buffer[10240]; 13*85fb39b8Ssam register int i; 14*85fb39b8Ssam 15*85fb39b8Ssam from = getdev("From", fbuf, 0); 16*85fb39b8Ssam to = getdev("To", tbuf, 1); 17*85fb39b8Ssam for (;;) { 18*85fb39b8Ssam i = read(from, buffer, sizeof (buffer)); 19*85fb39b8Ssam if (i != sizeof (buffer)) 20*85fb39b8Ssam break; 21*85fb39b8Ssam (void) write(to, buffer, i); 22*85fb39b8Ssam } 23*85fb39b8Ssam printf("Copy completed\n"); 24*85fb39b8Ssam /* can't call exit here */ 25*85fb39b8Ssam } 26*85fb39b8Ssam 27*85fb39b8Ssam getdev(prompt, buf, mode) 28*85fb39b8Ssam char *prompt, *buf; 29*85fb39b8Ssam int mode; 30*85fb39b8Ssam { 31*85fb39b8Ssam register int i; 32*85fb39b8Ssam 33*85fb39b8Ssam do { 34*85fb39b8Ssam printf("%s: ", prompt); 35*85fb39b8Ssam gets(buf); 36*85fb39b8Ssam i = open(buf, mode); 37*85fb39b8Ssam } while (i <= 0); 38*85fb39b8Ssam return (i); 39*85fb39b8Ssam } 40