smakefile:

26,27c26,27
< 	OPTIMIZE OPTTIME \
< #	DEBUG=FF
---
> 	OPTIMIZE OPTTIME
> #	Debug=FF
33c33
< EXTOBJS=amigalib/wait.c amigalib/s_socket.o amigalib/popen.o amigalib/waccess.o \
---
> EXTOBJS=amigalib/wait.o amigalib/s_socket.o amigalib/popen.o amigalib/waccess.o \

main.c

10c10
< #define FTP_VERSION "1.5.6 (September 20, 1993), Amiga version 1.01 (Nov 13, 1993)\n"
---
> #define FTP_VERSION "1.5.6 (September 20, 1993), Amiga version 1.02 (Dec 21, 1993)\n"
17a18,19
> #if __SASC
> extern int __buffsize;
18a21
> #endif
483a487,490
> #if defined(amigados) && __SASC
> 	__buffsize = xferbufsize; /* xferbufsize is initialized by now */
> #endif
> 

ftp.c:

1265,1269d1264
< #ifdef amigados
< 		/* greater buffer may reduce disk io */
< 		if(fout)
< 		    setvbuf(fout, NULL, _IOFBF, 65536); 
< #endif
1277d1271
< 
1280,1281c1274,1278
< 	int							c, d, do2;
< 
---
> 	int	c, d, do2;
> 	int bytes_in = 0;			/* bytes received to xferbuf */
> 	int in_file = fileno(din),
> 	    out_file = fileno(fout);
> 	
1287,1289c1284,1288
< 		/* Read a block from the input stream. */
< 		c = read(fileno(din), xferbuf, (int)xferbufsize);
< 
---
> 	  /* Read a block from the input stream. */
> 	  c = read(in_file, xferbuf+bytes_in, (int)xferbufsize-bytes_in);
> 	  
> 	  /* Check for errors that may have occurred while reading. */
> 	  if (c <= 0) {
1292,1304c1291,1298
< 			break;
< 
< 		/* Check for errors that may have occurred while reading. */
< 		if (c < 0) {
< 			/* Error occurred while reading. */
< 			if (errno != EPIPE)
< 				PERROR("ReceiveBinary", "netin");
< 			bytes = -1;
< 			break;
< 		}
< 
< 		/* Write out the same block we just read in. */
< 		d = write(fileno(fout), xferbuf, c);
---
> 		  break;
> 		
> 		/* Error occurred while reading. */
> 		if (errno != EPIPE)
> 		  PERROR("ReceiveBinary", "netin");
> 		bytes = -1;
> 		break;
> 	  }
1305a1300,1314
> 	  /* Update the byte counter. */
> 	  bytes_in += c;
> 	  bytes += (long) c;
> 
> 	  /* Print progress indicator. */
> 	  if (do2 != 0)
> 		do2 = progress_report(0);
> 	  
> 	  /*
> 	   * Write if buffer became full
> 	   */
> 	  if (bytes_in == (int)xferbufsize) {
> 		bytes_in = 0;
> 		/* Write out the whole block */
> 		d = write(out_file, xferbuf, (int)xferbufsize);
1307,1308c1316,1318
< 		if ((d < 0) || (ferror(fout))) {
< 			/* Error occurred while writing. */
---
> 		if (d < (int)xferbufsize) {
> 		  /* Error occurred while writing. */
> 		  if (d < 0)
1310,1312c1320
< 			break;
< 		}
< 		if (d < c) {
---
> 		  else
1314c1322
< 			break;
---
> 		  break;
1316,1322c1324
< 
< 		/* Update the byte counter. */
< 		bytes += (long) c;
< 
< 		/* Print progress indicator. */
< 		if (do2 != 0)
< 			do2 = progress_report(0);
---
> 	  }
1323a1326,1338
> 	/* Write out if necessary */
> 	if (bytes_in > 0) {
> 	  d = write(out_file, xferbuf, bytes_in);
> 	  
> 	  /* Check for write errors. */
> 	  if (d < bytes_in) {
> 		/* Error occurred while writing. */
> 		if (d < 0)
> 		  PERROR("ReceiveBinary", "outfile");
> 		else
> 		  (void) fprintf(stderr, "%s: short write\n", localfn);
> 	  }
> 	}
1546c1561
< 	
---
> 
1757a1773
> 
