Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!seismo!hao!hplabs!sri-unix!Satz@sri-tsc From: Satz@sri-tsc@sri-unix.UUCP Newsgroups: net.unix-wizards Subject: mods. to Utexas ftp Message-ID: <4767@sri-arpa.UUCP> Date: Wed, 7-Sep-83 01:41:00 EDT Article-I.D.: sri-arpa.4767 Posted: Wed Sep 7 01:41:00 1983 Date-Received: Sun, 4-Sep-83 22:48:41 EDT Lines: 168 From: Greg Satz I needed to use the Utexas ftp program from a pipe. I had to make the following modifications so it would work: **** /a/sys/arpanet/ftp.utexas/cmds.c Thu Mar 31 18:12:53 1983 --- cmds.c Fri Aug 26 00:15:26 1983 *************** *** 69,75 if (host) { connected = 1; if (autologin) ! login(host); } } --- 69,76 ----- if (host) { connected = 1; if (autologin) ! if (!login(host) && !fromatty) ! exit(1); } else if (!fromatty) exit(1); *************** *** 71,76 if (autologin) login(host); } } struct types { --- 72,79 ----- if (!login(host) && !fromatty) exit(1); } + else if (!fromatty) + exit(1); } struct types { *************** *** 560,566 return; if (chdir(argv[1]) < 0) { perror(argv[1]); ! return; } #if !pdp11 printf("Local directory now %s\n", getwd(buf)); --- 563,572 ----- return; if (chdir(argv[1]) < 0) { perror(argv[1]); ! if (fromatty) ! return; ! else ! exit(1); } #if !pdp11 printf("Local directory now %s\n", getwd(buf)); *** /a/sys/arpanet/ftp.utexas/ftp.c Thu Mar 31 18:27:44 1983 --- ftp.c Fri Aug 26 16:31:01 1983 *************** *** 279,286 case TYPE_I: case TYPE_L: errno = d = 0; ! while ((c = read(fileno (fin), buf, sizeof (buf))) > 0) { ! if ((d = write(fileno (dout), buf, c)) < 0) break; bytes += c; if (hash) { --- 279,286 ----- case TYPE_I: case TYPE_L: errno = d = 0; ! while ((c = fread(buf, sizeof (*buf), sizeof buf, fin)) > 0) { ! if ((d = fwrite(buf,sizeof (*buf), c, dout)) < 0) break; bytes += c; if (hash) { *************** *** 343,348 (void) close(data), data = -1; if (closefunc != NULL && fin != NULL) (*closefunc)(fin); goto done; } --- 343,350 ----- (void) close(data), data = -1; if (closefunc != NULL && fin != NULL) (*closefunc)(fin); + if (!fromatty) + exit(1); goto done; } *************** *** 411,418 case TYPE_I: case TYPE_L: errno = d = 0; ! while ((c = read(fileno(din), buf, sizeof (buf))) > 0) { ! if ((d = write(fileno(fout), buf, c)) < 0) break; bytes += c; if (hash) { --- 413,420 ----- case TYPE_I: case TYPE_L: errno = d = 0; ! while ((c = fread(buf, sizeof (*buf), sizeof buf, din)) > 0) { ! if ((d = fwrite(buf, sizeof (*buf), c, fout)) < 0) break; bytes += c; if (hash) { *************** *** 477,482 (void) close(data), data = -1; if (closefunc != NULL && fout != NULL) (*closefunc)(fout); goto done; } --- 479,486 ----- (void) close(data), data = -1; if (closefunc != NULL && fout != NULL) (*closefunc)(fout); + if (!fromatty) + exit(1); goto done; } *** /a/sys/arpanet/ftp.utexas/main.c Thu Mar 24 18:19:50 1983 --- main.c Thu Aug 25 23:54:50 1983 *************** *** 181,187 fflush(stdout); } if (gets(line) == 0) ! break; if (line[0] == 0) break; makeargv(); --- 181,190 ----- fflush(stdout); } if (gets(line) == 0) ! if (fromatty) ! break; ! else ! quit(); if (line[0] == 0) break; makeargv();