diff -rc ncftp.orig/Makefile ncftp/Makefile
*** ncftp.orig/Makefile	Mon Feb  1 06:30:17 1993
--- ncftp/Makefile	Sun Mar  7 23:04:41 1993
***************
*** 29,45 ****
  # that handles new style function declarations and prototypes (gcc should).
  
  CC=cc
! CFLAGS=-O
  LFLAGS=-s
  #CFLAGS=-g
  #LFLAGS=-g
  #CFLAGS=$(SGI_CFLAGS) -g
  
  # Additional libraries.
  # Some may need any of -lsocket, -lnet, -linet, -lintl, or -lnsl. 
  # You'll need -lcurses or -ltermcap if CURSES is defined.
  #
! MORELIBS= -lcurses
  
  
  DEFS=$(PDEFS) $(SDEFS)
--- 29,46 ----
  # that handles new style function declarations and prototypes (gcc should).
  
  CC=cc
! CFLAGS=-O -DTERM_FTP
  LFLAGS=-s
  #CFLAGS=-g
  #LFLAGS=-g
  #CFLAGS=$(SGI_CFLAGS) -g
+ FTPFLAGS = -I../term
  
  # Additional libraries.
  # Some may need any of -lsocket, -lnet, -linet, -lintl, or -lnsl. 
  # You'll need -lcurses or -ltermcap if CURSES is defined.
  #
! MORELIBS= -lcurses ../term/client.a -ltermcap
  
  
  DEFS=$(PDEFS) $(SDEFS)
***************
*** 60,66 ****
  	$(CC) $(CFLAGS) $(DEFS) cmdtab.c -c
  
  ftp.o: ftp.c sys.h defaults.h ftpdefs.h cmds.h main.h ftp.h getpass.h
! 	$(CC) $(CFLAGS) $(DEFS) ftp.c -c
  
  ftprc.o: ftprc.c sys.h defaults.h ftpdefs.h cmds.h main.h ftprc.h
  	$(CC) $(CFLAGS) $(DEFS) ftprc.c -c
--- 61,67 ----
  	$(CC) $(CFLAGS) $(DEFS) cmdtab.c -c
  
  ftp.o: ftp.c sys.h defaults.h ftpdefs.h cmds.h main.h ftp.h getpass.h
! 	$(CC) $(FTPFLAGS) $(CFLAGS) $(DEFS) ftp.c -c
  
  ftprc.o: ftprc.c sys.h defaults.h ftpdefs.h cmds.h main.h ftprc.h
  	$(CC) $(CFLAGS) $(DEFS) ftprc.c -c
diff -rc ncftp.orig/cmds.c ncftp/cmds.c
*** ncftp.orig/cmds.c	Mon Feb  1 06:28:34 1993
--- ncftp/cmds.c	Sun Mar  7 23:01:24 1993
***************
*** 87,99 ****
--- 87,107 ----
  extern FILE					*cin, *cout, *logf;
  extern int					Optind;
  extern char					*Optarg;
+ #ifndef linux
  extern int gethostname (char *, int);
+ #endif
  extern int ioctl (int, int, ...);
+ #ifdef TERM_FTP
+ extern int compress_toggle;
+ #endif
  
  struct var vars[] = {
  	{ "anon-password",		STR,	0,	anon_password,	(setvarproc) 0	},
  	{ "ansi-escapes",		INT,	0,	&ansi_escapes,	(setvarproc) 0	},
  	{ "auto-binary",		INT,	0,	&auto_binary,	(setvarproc) 0	},
+ #ifdef TERM_FTP
+ 	{ "compress",			INT,	0,	&compress_toggle,	(setvarproc) 0	},
+ #endif
  	{ "debug",				INT,	0,	&debug,			(setvarproc) 0	},
  	{ "local-dir",			STR,	0,	lcwd,			set_ldir 		},
  	{ "logfile",			STR,	0,	logfname,		set_log			},
diff -rc ncftp.orig/ftp.c ncftp/ftp.c
*** ncftp.orig/ftp.c	Mon Feb  1 06:28:36 1993
--- ncftp/ftp.c	Sun Mar  7 23:01:50 1993
***************
*** 17,24 ****
--- 17,26 ----
  #ifdef SYSSELECTH
  #   include <sys/select.h>
  #else
+ #ifndef linux
  extern int select (int, void *, void *, void *, struct timeval *);
  #endif
+ #endif
  
  #ifndef NO_UNISTDH		/* for prototypes only. */
  #	include <unistd.h>
***************
*** 88,94 ****
--- 90,147 ----
  
  #define UPDATE_100 2
  
+ #ifdef TERM_FTP
+ #include "client.h"
+ extern int lcompression, rcompression;
+ int compress_toggle = 0;
+ #endif
+ 
+ 
+ #ifdef TERM_FTP
+ 
+ int hookup(host, port)
+ char *host;
+ int port;
+ {
+ 	int s;
+ 
+ 	lcompression = rcompression = compress_toggle;
+ 
+ 	if ((s = connect_server(0)) < 0) {
+ 	    perror("ftp: connect to term server");
+ 	    return -1;
+ 	}
+ 	send_command(s, C_PORT, 0, "%s:%d", host, ntohs(port));
+ 	send_command(s, C_DUMB, 1, 0);
  
+ 	cin = fdopen(s, "r");
+ 	cout = fdopen(s, "w");
+ 	if (cin == NULL || cout == NULL) {
+ 		fprintf(stderr, "ftp: fdopen failed.\n");
+ 		if (cin)
+ 			fclose(cin);
+ 		if (cout)
+ 			fclose(cout);
+ 		code = -1;
+ 		goto bad;
+ 	}
+ 	Strncpy(hostname, host);
+ 	if (verbose)
+ 		printf("Connected to %s.\n", hostname);
+ 	if (getreply(0) > 2) { 	/* read startup message from server */
+ 		if (cin)
+ 			fclose(cin);
+ 		if (cout)
+ 			fclose(cout);
+ 		code = -1;
+ 		goto bad;
+ 	}
+ 	return 0;
+ bad:
+ 	(void) close(s);
+ 	return code;
+ }
+ #else
  int hookup(char *host, int port)
  {
  	register struct hostent *hp = 0;
***************
*** 200,206 ****
  	code = hErr;
  	return (hErr);
  }	/* hookup */
! 
  
  
  
--- 253,259 ----
  	code = hErr;
  	return (hErr);
  }	/* hookup */
! #endif
  
  
  
***************
*** 1285,1290 ****
--- 1338,1389 ----
   * server's connect may fail.
   */
  
+ #ifdef TERM_FTP
+ 
+ /*
+  * Need to request that the server go into passive mode and
+  * then get the address and port for the term server to connect to.
+  */
+ initconn()
+ {
+ 	int result;
+ 	int n[6];
+ 	int s;
+ 
+ 	if (data != -1)
+ 		(void) close(data);
+ 	result = command("PASV");
+ 	if (result == COMPLETE) {
+ 		if (sscanf(reply_string, "%*[^(](%d,%d,%d,%d,%d,%d)",
+ 			&n[0], &n[1], &n[2], &n[3], &n[4], &n[5]) != 6) {
+ 			printf("Cannot parse PASV response: %s\n",
+ 				 reply_string);
+ 			return 1;
+ 		}
+ 		close(data);
+ 		lcompression = rcompression = compress_toggle;
+ 		if ((s = connect_server(0)) < 0) {
+ 			perror("ftp: connect to term server");
+ 			data = -1;
+ 			return 1;
+ 		}
+ 		data = s;
+ 		send_command(s, C_PORT, 0, "%d.%d.%d.%d:%d",
+ 			n[0], n[1], n[2], n[3], 256*n[4] + n[5]);
+ 		send_command(s, C_COMPRESS, 1, "n");
+ 		send_command(s, C_DUMB, 1, 0);
+ 		return 0;
+ 	}
+ 	return 1;
+ }
+ 
+ FILE *
+ dataconn(lmode)
+ 	char *lmode;
+ {
+ 	return (fdopen(data, lmode));
+ }
+ #else /* TERM_FTP */
  initconn(void)
  {
  	register char		*p, *a;
***************
*** 1375,1379 ****
--- 1474,1479 ----
  	}
  	return (fp);
  }	/* dataconn */
+ #endif
  
  /* eof ftp.c */
