Only in ../orig/nc193: Blurb
Only in ../orig/nc193: README
diff -pw ../orig/nc193/cmds.c ./cmds.c
*** ../orig/nc193/cmds.c	Sun Mar 05 13:56:34 1995
--- ./cmds.c	Mon Mar 13 01:02:52 1995
*************** extern int					Optind;
*** 95,100 ****
--- 95,103 ----
  extern char               *Optarg;
  extern int               Optind;
  extern char               *Optarg;
+ #ifdef HAS_BPAGE
+ extern int bpage;
+ #endif
  
  #ifdef STRICT_PROTOS
  extern int gethostname(char *, int), getdomainname(char *, int);
*************** long GetDateSizeFromLSLine(char *fName, 
*** 129,135 ****
  	savedh = lshead;
  	savedt = lstail;
  	lshead = NULL;
! 	(void) recvrequest("LIST", "-", fName, "w");
  	is_ls = 0;
  	buffer_only = 0;
  	verbose = v;
--- 132,138 ----
     savedh = lshead;
     savedt = lstail;
     lshead = NULL;
!    (void) recvrequest("LIST", "-", fName, WRITE_MODE);
     is_ls = 0;
     buffer_only = 0;
     verbose = v;
*************** int setascii(int argc, char **argv) {	re
*** 351,357 ****
   */
  int put(int argc, char **argv)
  {
! 	char *cmd;
  
  	if (argc == 2) {
  		argc++;
--- 354,360 ----
   */
  int put(int argc, char **argv)
  {
!    char *cmd,*cp;
  
     if (argc == 2) {
        argc++;
*************** usage:
*** 368,373 ****
--- 371,387 ----
     if (argc < 3) 
        goto usage;
     cmd = (argv[0][0] == 'a') ? "APPE" : "STOR";
+ 
+ #ifdef __EMX__
+    /* clear out all of the backslashes */
+    for (cp = argv[1]; *cp != '\0'; cp++) 
+      if ( *cp == '\\' )
+ 	*cp = '/';
+    for (cp = argv[2]; *cp != '\0'; cp++) 
+      if ( *cp == '\\' )
+ 	*cp = '/';
+ #endif /* __EMX__ */
+    
     (void) sendrequest(cmd, argv[1], argv[2]);
     return NOERR;
  }   /* put */
*************** int rem_glob_one(char *pattern)
*** 451,459 ****
  	(void) tmp_name(tname);
  	oldverbose = verbose;
  	verbose = V_QUIET;
! 	(void) recvrequest ("NLST", tname, pattern, "w");
  	verbose = oldverbose;
! 	ftemp = fopen(tname, "r");
  	(void) chmod(tname, 0600);
  	if (ftemp == NULL || FGets(str, ftemp) == NULL) {
  		if (NOT_VQUIET)
--- 465,473 ----
     (void) tmp_name(tname);
     oldverbose = verbose;
     verbose = V_QUIET;
!    (void) recvrequest ("NLST", tname, pattern, WRITE_MODE);
     verbose = oldverbose;
!    ftemp = fopen(tname, READ_MODE);
     (void) chmod(tname, 0600);
     if (ftemp == NULL || FGets(str, ftemp) == NULL) {
        if (NOT_VQUIET)
*************** int get(int argc, char **argv)
*** 491,499 ****
--- 505,532 ----
     char *cp;
     int oldtype = curtype, try_zcat;
     size_t len;
+ #ifdef HAS_BPAGE
+    int bpaging = 0;
+ #endif
+ 
+ #ifdef __EMX__
+    /* clear out all of the backslashes */
+    if ( argc > 1 )
+       for (cp = argv[1]; *cp != '\0'; cp++) 
+ 	 if ( *cp == '\\' )
+ 	    *cp = '/';
+    if ( argc > 2 )
+       for (cp = argv[2]; *cp != '\0'; cp++) 
+ 	 if ( *cp == '\\' )
+ 	    *cp = '/';
+ #endif /* __EMX__ */
     
     /* paging mode is set if the command name is 'page' or 'more.' */
     paging = (**argv != 'g');
+ #ifdef HAS_BPAGE
+    /* bpaging mode is set if the command name is 'bpage' or 'bmore.' */
+    bpaging = (**argv == 'b');
+ #endif
  
     if (argc < 2)
        argv = re_makeargv("(remote-file) ", &argc);
*************** int get(int argc, char **argv)
*** 539,550 ****
--- 572,597 ----
        
         if (try_zcat) {
           (void) _settype("b");
+ #ifdef HAS_BPAGE
+ 	 if ( bpage ) 
+ 	    (void) sprintf(local_file, "+%s ", ZCAT);
+ 	 else 
+ #endif
           (void) sprintf(local_file, "|%s ", ZCAT);
           argv[2] = Strncat(local_file, pager);
        } else {
           /* Try to use text mode for paging, so newlines get converted. */
           (void) _settype("a");
           argv[2] = pager;
+ #ifdef HAS_BPAGE
+ 	 /* 
+ 	  * A "+" is used to indicate it's a pipe to a new window, just as a
+ 	  * "|" is used to indicate it's a normal pipe. Somewhat hackish, but
+ 	  * presumably no one will be getting a file that begins with "+".
+ 	  */
+ 	 if ( bpaging || bpage )
+ 	    *(argv[2]) = '+';
+ #endif
        }
     } else {
        /* normal get */
*************** int get(int argc, char **argv)
*** 559,565 ****
  			(void) LocalDotPath(argv[2]);
  		}
  	}
! 	(void) recvrequest("RETR", argv[2], argv[1], "w");
  	if (paging) {
  		(void) SetTypeByNumber(oldtype);	/* Restore it to what it was. */
  		paging = 0;
--- 606,613 ----
           (void) LocalDotPath(argv[2]);
        }
     }
!    (void) recvrequest("RETR", argv[2], argv[1], 
! 		      (curtype==TYPE_I)?WRITE_MODE:TEXT_WRITE_MODE);
     if (paging) {
        (void) SetTypeByNumber(oldtype);   /* Restore it to what it was. */
        paging = 0;
*************** int mget(int argc, char **argv)
*** 612,618 ****
  		}
  		if (activemcmd && confirm(argv[0], cp)) {
  			(void) Strncpy(local, cp);
! 			(void) recvrequest("RETR", local, cp, "w");
  			if (!activemcmd && fromatty) {
  				if (confirm("Continue with","mget")) {
  					activemcmd++;
--- 660,667 ----
        }
        if (activemcmd && confirm(argv[0], cp)) {
           (void) Strncpy(local, cp);
!          (void) recvrequest("RETR", local, cp,
! 			    (curtype==TYPE_I)?WRITE_MODE:TEXT_WRITE_MODE);
           if (!activemcmd && fromatty) {
              if (confirm("Continue with","mget")) {
                 activemcmd++;
*************** xx:
*** 652,658 ****
  		(void) tmp_name(tmpname);
  		oldverbose = verbose, verbose = V_QUIET;
  		*errs = 0;
! 		for (mode = "w", i=1; argv[i] != NULL; i++, mode = "a") {
  			result = recvrequest ("NLST", tmpname, argv[i], mode);
  			if (i == 1)
  				(void) chmod(tmpname, 0600);
--- 701,707 ----
        (void) tmp_name(tmpname);
        oldverbose = verbose, verbose = V_QUIET;
        *errs = 0;      
!       for (mode = WRITE_MODE, i=1; argv[i] != NULL; i++, mode = APPEND_MODE) {
           result = recvrequest ("NLST", tmpname, argv[i], mode);
           if (i == 1)
              (void) chmod(tmpname, 0600);
*************** xx:
*** 671,677 ****
  			(void) unlink(tmpname);		/* Shouldn't be there anyway. */
  			return NULL;
  		}
! 		ftemp = fopen(tmpname, "r");
  		if (ftemp == NULL) {
  			PERROR("remglob", tmpname);
  			return (NULL);
--- 720,726 ----
           (void) unlink(tmpname);      /* Shouldn't be there anyway. */
           return NULL;
        }
!       ftemp = fopen(tmpname, READ_MODE);
        if (ftemp == NULL) {
           PERROR("remglob", tmpname);
           return (NULL);
*************** int _cd(char *dir)
*** 793,798 ****
--- 842,856 ----
     int result = 0;
     string str;
  
+ #ifdef __EMX__
+    /* clear out all of the backslashes */
+    if ( dir ) {
+       for (cp = dir; *cp != '\0'; cp++) 
+ 	 if ( *cp == '\\' )
+ 	    *cp = '/';
+    }
+ #endif /* __EMX__ */
+    
     if (dir == NULL)
        goto getrwd;
     /* Won't work because glob really is a ls, so 'cd pu*' will match
*************** int lcd(int argc, char **argv)
*** 837,843 ****
--- 895,905 ----
        return USAGE;
     }
     (void) Strncpy(ldir, argv[1]);
+ #ifdef __EMX__   
+    if (_chdir2(LocalDotPath(ldir)) < 0) {
+ #else     
     if (chdir(LocalDotPath(ldir)) < 0) {
+ #endif     
        PERROR("lcd", ldir);
        return CMDERR;
     }
*************** int ls(int argc, char **argv)
*** 959,964 ****
--- 1021,1029 ----
     PurgeLineBuffer();
     pagemode = 0;
     switch (**argv) {
+ #ifdef HAS_BPAGE
+       case 'b':
+ #endif
        case 'p':                     /* pls, pdir, pnlist */
           pagemode = 1;
           listmode = argv[0][1] == 'd';
*************** int ls(int argc, char **argv)
*** 974,979 ****
--- 1039,1049 ----
     (void) strncpy(local, (pagemode ? pager : "-"), sizeof(local));
     remote[0] = lsflags[0] = 0;
  
+ #ifdef HAS_BPAGE
+    if ( **argv == 'b' && pagemode ) 
+       local[0] = '+';
+ #endif
+    
     /* Possible scenarios:
      *  1.   ls
      *  2.   ls -flags
*************** int ls(int argc, char **argv)
*** 996,1001 ****
--- 1066,1074 ----
               */
              (void) strncat(lsflags, (argv[i] + (lsflags[0] == '-')), sizeof(lsflags));
              break;
+ #ifdef HAS_BPAGE
+          case '+':
+ #endif
           case '|':
              (void) Strncpy(local, argv[i]);
              LocalDotPath(local + 1);
*************** aa:
*** 1058,1064 ****
  		(void) sprintf(remote, "%s%c%s", lsflags, LS_FLAGS_AND_FILE, str);
  	else
  		(void) strncpy(remote, lsflags[0] ? lsflags : str, sizeof(remote));
! 	(void) recvrequest(whichcmd, local, (remote[0] == 0 ? NULL : remote), "w");
  	is_ls=0;
  	return NOERR;
  }	/* ls */
--- 1131,1137 ----
        (void) sprintf(remote, "%s%c%s", lsflags, LS_FLAGS_AND_FILE, str);
     else
        (void) strncpy(remote, lsflags[0] ? lsflags : str, sizeof(remote));
!    (void) recvrequest(whichcmd, local, (remote[0] == 0 ? NULL : remote), WRITE_MODE);
     is_ls=0;
     return NOERR;
  }   /* ls */
*************** aa:
*** 1068,1073 ****
--- 1141,1173 ----
  /*
   * Do a shell escape
   */
+ #ifdef __EMX__
+ #include <process.h>
+ /* use the spawn method, rather than inefficent forks */
+ int shell(int argc, char **argv)
+ {
+   char         *theShell, *namep;
+   string         str;
+   
+   if ((theShell = getenv("SHELL")) == NULL)
+     theShell = uinfo.shell;
+   if (theShell == NULL)
+     theShell = "/bin/sh";
+   namep = rindex(theShell, '/');
+   if (namep == NULL)
+     namep = theShell;
+   (void) strcpy(str, "-");
+   (void) strcat(str, ++namep);
+   if (strcmp(namep, "sh") != 0)
+     str[0] = '+';
+   dbprintf ("%s\n", theShell);
+   if (argc > 1)
+     (void) spawnl(P_WAIT, theShell, str, "/c", altarg, (char *)0);
+   else
+     (void) spawnl(P_WAIT, theShell, str, (char *)0);
+   return NOERR;
+ }   /* shell */
+ #else
  /*ARGSUSED*/
  int shell(int argc, char **argv)
  {
*************** int shell(int argc, char **argv)
*** 1124,1130 ****
  	}
  	return NOERR;
  }	/* shell */
! 
  
  
  
--- 1224,1230 ----
     }
     return NOERR;
  }   /* shell */
! #endif /* __EMX__ */
  
  
  
*************** int create(int argc, char **argv)
*** 1863,1869 ****
  		return USAGE;
  	}
  	(void) tmp_name(str);
! 	ftemp = fopen(str, "w");
  	/* (void) fputc('x', ftemp); */
  	(void) fclose(ftemp);
  	creating = 1;
--- 1963,1969 ----
        return USAGE;
     }
     (void) tmp_name(str);
!    ftemp = fopen(str, WRITE_MODE);
     /* (void) fputc('x', ftemp); */
     (void) fclose(ftemp);
     creating = 1;
*************** int show_version(int argc, char **argv)
*** 1885,1892 ****
  
  	(void) printf("%-30s %s\n", "NcFTP Version:", version);
  	(void) printf("%-30s %s\n", "Author:",
! 		"Mike Gleason, NCEMRSoft (mgleason@cse.unl.edu).");
! 
  /* Now entering CPP hell... */
  #ifdef __DATE__
  	(void) printf("%-30s %s\n", "Compile Date:", __DATE__);
--- 1985,1997 ----
  
     (void) printf("%-30s %s\n", "NcFTP Version:", version);
     (void) printf("%-30s %s\n", "Author:",
!       "Mike Gleason, NCEMRSoft <mgleason@cse.unl.edu>.");
! #ifdef __EMX__
!    (void) printf("%-30s %s\n", "Ported to OS/2 by:",
! 				 "Steve Willer <willer@io.org>.");
!    (void) printf("  %s\n", 
! 				 "Please report bugs to Steve for this version.");
! #endif   
  /* Now entering CPP hell... */
  #ifdef __DATE__
     (void) printf("%-30s %s\n", "Compile Date:", __DATE__);
*************** int show_version(int argc, char **argv)
*** 2053,2058 ****
--- 2158,2166 ----
  #ifdef GATEWAY
     DStrs[nDStrs++] = "GATEWAY";
  #endif
+ #ifdef DYNGATEWAY
+    DStrs[nDStrs++] = "DYNGATEWAY";
+ #endif
  #ifdef SOCKS
     DStrs[nDStrs++] = "SOCKS";
  #endif
*************** int show_version(int argc, char **argv)
*** 2095,2101 ****
  		dRECENTF, dRECENT_ON, dMAXRECENTS,
  		dREDIALDELAY, dANONOPEN, NEWMAILMESSAGE
  	);
! #ifdef GATEWAY
  	(void) printf("\
      Gateway Login: %s\n", dGATEWAY_LOGIN);
  #endif
--- 2203,2209 ----
        dRECENTF, dRECENT_ON, dMAXRECENTS,
        dREDIALDELAY, dANONOPEN, NEWMAILMESSAGE
     );
! #if defined(GATEWAY) && !defined(DYNGATEWAY)
     (void) printf("\
      Gateway Login: %s\n", dGATEWAY_LOGIN);
  #endif
*************** void PurgeLineBuffer(void)
*** 2125,2153 ****
  int ShowLineBuffer(int argc, char **argv)
  {
  	register struct lslist *a = lshead;
! 	int pagemode;
  	FILE *fp;
! 	Sig_t oldintp;
  
  	if (a == NULL)
  		return CMDERR;
! 	pagemode= (**argv) == 'p' && pager[0] == '|';
! 	if (pagemode) {
! 		fp = popen(pager + 1, "w");
  		if (!fp) {
  			PERROR("ShowLineBuffer", pager + 1);
  			return CMDERR;
  		}
- 	} else
- 		fp = stdout;
- 	oldintp = Signal(SIGPIPE, SIG_IGN);
  	while (a) {
  		if (a->string)
  			(void) fprintf(fp, "%s\n", a->string);
  		a = a->next;
  	}
  	if (pagemode)
! 		(void) pclose(fp);
  	if (oldintp)
  		(void) Signal(SIGPIPE, oldintp);
  	return NOERR;
--- 2233,2272 ----
  int ShowLineBuffer(int argc, char **argv)
  {
     register struct lslist *a = lshead;
!    int pagemode = 0;
!    int filetype = 0;
     FILE *fp;
!    Sig_t oldintp = NULL;
  
     if (a == NULL)
        return CMDERR;
!    
! #ifdef HAS_BPAGE
!    if ( **argv == 'b' || (**argv=='p' && bpage) ) {
!       pagemode = 1;
!       filetype = IS_BPIPE;
!       fp = OpenOutputFile(filetype,pager,TEXT_WRITE_MODE,&oldintp);
!    } else
! #endif
!    if ( **argv == 'p' ) {
!       pagemode = 1;
!       filetype = IS_PIPE;
!       fp = OpenOutputFile(filetype,pager,TEXT_WRITE_MODE,&oldintp);
!    } else
!      fp = stdout;
! 
     if (!fp) {
        PERROR("ShowLineBuffer", pager + 1);
        return CMDERR;
     }
     while (a) {
        if (a->string)
  	 (void) fprintf(fp, "%s\n", a->string);
           a = a->next;
        }
+    
     if (pagemode)
!       CloseOutputFile(fp,filetype,NULL,0);
     if (oldintp)
        (void) Signal(SIGPIPE, oldintp);
     return NOERR;
diff -pw ../orig/nc193/cmdtab.c ./cmdtab.c
*** ../orig/nc193/cmdtab.c	Sun Mar 05 13:56:34 1995
--- ./cmdtab.c	Sat Mar 11 22:18:32 1995
*************** Examples:\n\
*** 86,92 ****
      -g N   : Redial, giving up after N tries.\n\
      :path  : Open site, then retrieve file \"path.\"  WWW-style paths are\n\
               also acceptable, i.e. 'ftp://cse.unl.edu/mgleason/README.'"
! 
  #define PAGEHELP "view a file on the remote host with your $PAGER"
  #define PAGEUSAGE REMOTEFILE
  
--- 86,94 ----
      -g N   : Redial, giving up after N tries.\n\
      :path  : Open site, then retrieve file \"path.\"  WWW-style paths are\n\
               also acceptable, i.e. 'ftp://cse.unl.edu/mgleason/README.'"
! #ifdef HAS_BPAGE
! #define BPAGEHELP "view a file on the remote host with your $PAGER, in a new window"
! #endif /* HAS_BPAGE */
  #define PAGEHELP "view a file on the remote host with your $PAGER"
  #define PAGEUSAGE REMOTEFILE
  
*************** struct cmd cmdtab[] = {
*** 121,126 ****
--- 123,143 ----
  		"" },
  	{ "bell",          0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  	{ "binary",		   1,  1,  setbinary, BINARYHELP, BINARYUSAGE },
+ #ifdef HAS_BPAGE
+ 	{ "bmore",  		   1,  1,  get, BPAGEHELP, PAGEUSAGE },
+ 	{ "bpage",		   1,  1,  get, BPAGEHELP, PAGEUSAGE },
+ 	{ "bdir",  		   1,  0,  ls,
+ 		"view a remote directory listing (long mode) with your $PAGER \n"
+ 	        " in a different window",
+ 		PDIRUSAGE },
+ 	{ "bls",   		   1,  0,  ls,
+ 		"view a remote directory listing (short mode) with your $PAGER \n"
+                 "",
+ 		PDIRUSAGE },
+ 	{ "bredir",		   1,  0,  ShowLineBuffer,
+ 		"view the last remote directory listing with your $PAGER",
+ 		EMPTYSTR },
+ #endif 
  	{ "bye",   		   0,  1,  quit, QUITHELP, QUITUSAGE },
  	{ "case",          0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  	{ "cd",			   1,  0,  cd, CHDIRHELP, CHDIRUSAGE },
Only in .: diffs.txt
diff -pw ../orig/nc193/ftp.c ./ftp.c
*** ../orig/nc193/ftp.c	Sun Mar 05 13:56:34 1995
--- ./ftp.c	Sun Mar 12 23:23:42 1995
*************** extern int select(int, fd_set *, fd_set 
*** 56,61 ****
--- 56,67 ----
  #include "defaults.h"
  #include "copyright.h"
  
+ #ifdef __EMX__
+ #include "sys/ea.h"
+ static struct _ea thisea;
+ static int apply_ea;
+ #endif
+ 
  /* ftp.c globals */
  struct            sockaddr_in hisctladdr;
  struct            sockaddr_in data_addr;
*************** int hookup(char *host, unsigned int port
*** 209,216 ****
  		PERROR("hookup", "getsockname");
  		goto bad;
  	}
! 	cin = safeopen(s, "r");
! 	cout = safeopen(dup(s), "w");
  	if (cin == NULL || cout == NULL) {
  		(void) fprintf(stderr, "ftp: safeopen failed.\n");
  		close_streams(0);
--- 215,222 ----
        PERROR("hookup", "getsockname");
        goto bad;
     }
!    cin = safeopen(s, READ_MODE);
!    cout = safeopen(dup(s), WRITE_MODE);
     if (cin == NULL || cout == NULL) {
        (void) fprintf(stderr, "ftp: safeopen failed.\n");
        close_streams(0);
*************** int Login(char *userNamePtr, char *passW
*** 300,307 ****
--- 306,323 ----
  #ifdef GATEWAY
     if (*gateway)
        (void) sprintf(str, "USER %s@%s",
+ /* DYNGATEWAY indicates a gateway where the login is
+  * <intended_login_name_at_remote_host>@<remote_host>
+  * In other words, a static ftp@something.com is not used. Some gateways
+  * work this way.
+  */
+ #ifdef  DYNGATEWAY
+             userNamePtr,
+             hostname);
+ #else   
              (*gate_login ? gate_login : dGATEWAY_LOGIN),
              hostname);
+ #endif /* GATEWAY2 */   
     else
  #endif
        (void) sprintf(str, "USER %s", userNamePtr);
*************** printLine:		(void) fputs(dp, stdout);
*** 652,659 ****
  
  
  
! 
  static int empty(struct fd_set *mask, int sec)
  {
  	struct timeval t;
  
--- 668,678 ----
  
  
  
! #ifdef __EMX__
! static int empty(fd_set *mask, int sec)
! #else
  static int empty(struct fd_set *mask, int sec)
+ #endif
  {
     struct timeval t;
  
*************** int sendrequest(char *cmd, char *local, 
*** 969,975 ****
  
  	oldintr = NULL;
  	oldintp = NULL;
! 	mode = "w";
  	bytes = file_size = 0L;
  	if (setjmp(sendabort)) {
  		while (cpend) {
--- 988,994 ----
  
     oldintr = NULL;
     oldintp = NULL;
!    mode = WRITE_MODE;
     bytes = file_size = 0L;
     if (setjmp(sendabort)) {
       while (cpend) {
*************** int sendrequest(char *cmd, char *local, 
*** 994,1000 ****
  	} else if (*local == '|') {
  		filetype = IS_PIPE;
  		oldintp = Signal(SIGPIPE,SIG_IGN);
! 		fin = popen(local + 1, "r");
  		if (fin == NULL) {
  			PERROR("sendrequest", local + 1);
  			(void) Signal(SIGINT, oldintr);
--- 1013,1019 ----
     } else if (*local == '|' ) {
        filetype = IS_PIPE;
        oldintp = Signal(SIGPIPE,SIG_IGN);
!       fin = popen(local + 1, TEXT_READ_MODE);
        if (fin == NULL) {
           PERROR("sendrequest", local + 1);
           (void) Signal(SIGINT, oldintr);
*************** int sendrequest(char *cmd, char *local, 
*** 1004,1010 ****
  		}
  	} else {
  		filetype = IS_FILE;
! 		fin = fopen(local, "r");
  		if (fin == NULL) {
  			PERROR("sendrequest", local);
  			(void) Signal(SIGINT, oldintr);
--- 1023,1029 ----
        }
     } else {
        filetype = IS_FILE;
!       fin = fopen(local, (curtype==TYPE_I)?READ_MODE:TEXT_READ_MODE);
        if (fin == NULL) {
           PERROR("sendrequest", local);
           (void) Signal(SIGINT, oldintr);
*************** int IssueCommand(char *ftpcmd, char *rem
*** 1295,1311 ****
  FILE *OpenOutputFile(int filetype, char *local, char *mode, Sig_t *oldintp)
  {
  	FILE *fout;
  
  	if (filetype == IS_STREAM) {
  		fout = stdout;
  	} else if (filetype == IS_PIPE) {
  		/* If it is a pipe, the pipecmd will have a | as the first char. */
  		++local;
! 		fout = popen(local, "w");
  		*oldintp = Signal(SIGPIPE, abortrecv);
  	} else {
  		fout = fopen(local, mode);
  	}
  	if (fout == NULL)
  		PERROR("OpenOutputFile", local);
  	return (fout);
--- 1314,1439 ----
  FILE *OpenOutputFile(int filetype, char *local, char *mode, Sig_t *oldintp)
  {
     FILE *fout;
+ #ifdef TRUNCATE_BAD_OPEN   
+    char newfname[1024];
+    char oldfname[1024];
+    char *pch,*pch2;
+ #endif   
+ #ifdef HAS_BPAGE
+    char newpipe[1024];
+ #endif
+ #ifdef __EMX__
+    static char eadata[1024];
+ #endif
+ 
+ #ifdef __EMX__
+    apply_ea = 0;
+ #endif
  
     if (filetype == IS_STREAM) {
        fout = stdout;
     } else if (filetype == IS_PIPE) {
        /* If it is a pipe, the pipecmd will have a | as the first char. */
        ++local;
!       fout = popen(local, TEXT_WRITE_MODE);
!       *oldintp = Signal(SIGPIPE, abortrecv);
! #ifdef HAS_BPAGE
!    } else if (filetype == IS_BPIPE) {
!       ++local;
!       strcpy(newpipe,"start \"NcFTP Viewer\" /c /f ");
!       strcat(newpipe,local);
!       fout = popen(newpipe, TEXT_WRITE_MODE);
        *oldintp = Signal(SIGPIPE, abortrecv);
+ #endif
     } else {
        fout = fopen(local, mode);
     }
+ #ifdef TRUNCATE_BAD_OPEN
+ /*
+  * In OS/2, of course, it is possible for us to be trying to "get" a
+  * file with a weird name and put it into a FAT directory. Plus, we
+  * might try to get a file with ';' or something else weird in it
+  * and put it anywhere. This would all be illegal, but we can trap
+  * this and try it again. It is assumed that AdjustLocalPathName is called
+  * before this function, so the path is all delimited by '/''s.
+  * If the filename is simply too long for 8.3, then errno==ENAMETOOLONG.
+  * If the filename has junk in it, then errno==ENOENT.
+  * We also assume the pathname is okay. We only adjust the filename.
+  */
+    if (fout == NULL && filetype != IS_STREAM && filetype != IS_PIPE
+ #ifdef HAS_BPAGE
+        && filetype != IS_BPIPE
+ #endif
+        ) {
+       if ( errno == ENAMETOOLONG || errno == ENOENT ) {
+ 	 strcpy(oldfname,local);
+ 	 pch = rindex(local,'/');
+ 	 
+ 	 if ( pch == NULL )
+ 	    pch = rindex(local,':');
+ 	 else
+ 	    pch++;
+ 	 
+ 	 if ( pch == NULL )
+ 	    pch = local;
+ 	 else
+ 	    pch++;
+ 	 /* pch should point to the filename now */
+ 	 if ( *pch == '.' )
+ 	    *pch = '_';
+ 	 pch2 = rindex(local,'.');
+ 	 if ( pch2 ) {
+ 	    strncpy(newfname,local,(pch2-local));
+ 	    newfname[pch2-local] = '\0';
+          } else {
+             strcpy(newfname,local);
+          }
+ 	 /* clean up the name without the extension */
+ 	 pch = newfname + (pch-local);
+ 	 if ( index(pch,'.') )
+ 	    *(index(pch,'.'))  = '\0';
+ 	 if ( strlen(pch) > 8 )
+ 	    pch[8] = '\0';
+ 	 for (; *pch != '\0'; pch++) 
+ 	    if ( !isalnum(*pch) )
+ 	       *pch = '_';
+ 	 /* clean up the extension */
+ 	 if ( pch2 ) {
+ 	    pch2++;
+ 	    if ( strlen(pch2) > 3 )
+ 	       pch2[3] = '\0';
+ 	    for (pch = pch2; *pch != '\0'; pch++) 
+ 	       if ( !isalnum(*pch) )
+ 		  *pch = '_';
+ 	    strcat(newfname,".");
+ 	    strcat(newfname,pch2);
+ 	 }
+ 	 /*
+ 	  * Phew! Well, we may have a better filename now, so
+ 	  * we try it again.
+ 	  */
+ 	 fout = fopen(newfname, mode);
+ 	 if ( fout ) {
+             /* the transformation worked, so we report it and set the EA */
+ 	    /* strlen(newfname) <= strlen(local) */
+ 	    printf(" ** File '%s' has been renamed to '%s'.\n ** Attributes will be set.\n",oldfname,newfname);
+ 	    thisea.flags = 0;
+ 	    thisea.size = strlen(oldfname)+4;
+             *((USHORT*)eadata) = EAT_ASCII;
+             *((USHORT*)(eadata+2)) = (USHORT)strlen(oldfname);
+             memcpy(eadata+4,oldfname,strlen(oldfname));
+             /*
+             thisea.size = strlen(oldfname);
+             strcpy(eadata,oldfname);
+             */
+             thisea.value = eadata;
+             apply_ea = 1;
+ 	    strcpy(local,newfname);
+          }
+       } /* if ( errno == ... ) */
+    } /* if ( fout == NULL ) */
+ #endif
+    
     if (fout == NULL)
        PERROR("OpenOutputFile", local);
     return (fout);
*************** void CloseOutputFile(FILE *f, int filety
*** 1482,1487 ****
--- 1610,1621 ----
     struct utimbuf            ut;
  
     if (f != NULL) {
+ #ifdef __EMX__
+       if ( apply_ea ) {
+ 	 if ( _ea_put(&thisea, NULL, fileno(f), ".LONGNAME") ) 
+ 	    PERROR("CloseOutputFile", "ea apply");
+       }
+ #endif
        (void) fflush(f);
        if (filetype == IS_FILE) {
           (void) fclose(f);
*************** void CloseOutputFile(FILE *f, int filety
*** 1491,1498 ****
  				(void) utime(name, &ut);
  			}
  #endif	/* DONT_TIMESTAMP */
! 		} else if (filetype == IS_PIPE) {
! 			(void)pclose(f);
  		}
  	}
  }	/* close_file */
--- 1625,1637 ----
              (void) utime(name, &ut);
           }
  #endif   /* DONT_TIMESTAMP */
!       } else if (filetype == IS_PIPE
! #ifdef HAS_BPAGE
!                  || filetype == IS_BPIPE
! #endif
!                 ) {
!          if ( pclose(f) ) 
!             PERROR("CloseOutputFile", "pclose");
        }
     }
  }   /* close_file */
*************** int FileType(char *fname)
*** 1522,1527 ****
--- 1661,1670 ----
        ft = IS_STREAM;
     else if (*fname == '|')
        ft = IS_PIPE;
+ #ifdef HAS_BPAGE
+    else if (*fname == '+')
+       ft = IS_BPIPE;
+ #endif
     return (ft);
  }   /* FileType */
  
*************** int recvrequest(char *cmd, char *local, 
*** 1545,1551 ****
--- 1688,1698 ----
     int                     oldtype = -1, is_retr;
     int                     nfnd;
     char                  msg;
+ #ifdef __EMX__   
+    fd_set            mask;
+ #else
     struct fd_set            mask;
+ #endif   
     int                     filetype, do_reports = 0;
     string                  remote_dir;
     time_t                  remfTime = 0;
*************** int recvrequest(char *cmd, char *local, 
*** 1585,1591 ****
  	if ((fout = OpenOutputFile(filetype, local, mode, &oldintp)) == NULL)
  		goto xx;
  
! 	if ((din = dataconn("r")) == NULL)
  		goto Abort;
  
  #ifdef TRY_NOREPLY
--- 1732,1738 ----
     if ((fout = OpenOutputFile(filetype, local, mode, &oldintp)) == NULL)
        goto xx;
  
!    if ((din = dataconn(READ_MODE)) == NULL)
        goto Abort;
  
  #ifdef TRY_NOREPLY
diff -pw ../orig/nc193/ftp.h ./ftp.h
*** ../orig/nc193/ftp.h	Sun Mar 05 13:56:34 1995
--- ./ftp.h	Sat Mar 11 16:24:56 1995
***************
*** 11,16 ****
--- 11,17 ----
  #define IS_FILE 1
  #define IS_STREAM 0
  #define IS_PIPE -1
+ #define IS_BPIPE -2
  
  /* Progress-meter types. */
  #define pr_none 0
diff -pw ../orig/nc193/ftprc.c ./ftprc.c
*** ../orig/nc193/ftprc.c	Sun Mar 05 13:56:34 1995
--- ./ftprc.c	Sat Mar 11 23:56:22 1995
***************
*** 17,22 ****
--- 17,23 ----
  #include "main.h"
  #include "cmds.h"
  #include "set.h"
+ #include "ftp.h"
  #include "defaults.h"
  #include "copyright.h"
  
*************** extern string			anon_password;		/* most 
*** 36,41 ****
--- 37,46 ----
  extern string			pager;
  extern struct userinfo	uinfo;
  
+ #ifdef HAS_BPAGE
+ extern int bpage;
+ #endif
+ 
  int thrash_rc(void)
  {
  	struct stat			st;
*************** int thrash_rc(void)
*** 73,78 ****
--- 78,87 ----
  		(void) sprintf(rcname, "%s/.%s", uinfo.homedir, rc);
  		if (stat(rcname, &st) == 0)
  			goto foundrc;
+ 
+ 	    (void) sprintf(rcname, "%s/%s", uinfo.homedir, rc);
+ 		if (stat(rcname, &st) == 0)
+ 			goto foundrc;
  	}
  
  	return (0);	/* it's OK not to have an rc. */
*************** foundrc:	
*** 81,87 ****
  	if ((st.st_mode & 077) != 0)				/* rc must be unreadable by others. */
  		(void) chmod(rcname, 0600);
  
! 	if ((fp = fopen(rcname, "r")) == NULL) {
  		PERROR("thrash_rc", rcname);
  		return -1;
  	}
--- 90,96 ----
  	if ((st.st_mode & 077) != 0)				/* rc must be unreadable by others. */
  		(void) chmod(rcname, 0600);
  
! 	if ((fp = fopen(rcname, TEXT_READ_MODE)) == NULL) {
  		PERROR("thrash_rc", rcname);
  		return -1;
  	}
*************** void ReadRecentSitesFile(void)
*** 218,224 ****
  
  	nRecents = 0;
  	if (recent_file[0] != 0 && keep_recent) {
! 		rfp = fopen(recent_file, "r");
  		if (rfp != NULL) {
  			for (; nRecents < dMAXRECENTS; ) {
  				r = &recents[nRecents];
--- 227,233 ----
  
  	nRecents = 0;
  	if (recent_file[0] != 0 && keep_recent) {
! 		rfp = fopen(recent_file, TEXT_READ_MODE);
  		if (rfp != NULL) {
  			for (; nRecents < dMAXRECENTS; ) {
  				r = &recents[nRecents];
*************** int WriteRecentSitesFile(void)
*** 267,273 ****
  
  	if ((recent_file[0] != 0) && (nRecents > 0) && (keep_recent)) {
  		dbprintf("Attempting to write %s...\n", recent_file);
! 		rfp = fopen(recent_file, "w");
  		if (rfp != NULL) {
  			SortRecentList();
  			for (i=0; i<nRecents; i++) {
--- 276,282 ----
  
  	if ((recent_file[0] != 0) && (nRecents > 0) && (keep_recent)) {
  		dbprintf("Attempting to write %s...\n", recent_file);
! 		rfp = fopen(recent_file, TEXT_WRITE_MODE);
  		if (rfp != NULL) {
  			SortRecentList();
  			for (i=0; i<nRecents; i++) {
*************** void PrintSiteList(void)
*** 363,375 ****
  	int						i, j;
  	siteptr					s, s2;
  	FILE					*pagerfp;
! 	Sig_t					sigpipe;
  
  	if (fromatty) {
  		j = 0;
  		i = 1;
! 		sigpipe = Signal(SIGPIPE, SIG_IGN);
! 		if ((pagerfp = popen(pager + 1, "w")) == NULL)
  			pagerfp = stdout;
  		if (nRecents > 0) {
  			j++;
--- 372,390 ----
     int						i, j;
     siteptr					s, s2;
     FILE					*pagerfp;
!    Sig_t					sigpipe = NULL;
!    int ftype = IS_PIPE;
! 
! #ifdef HAS_BPAGE
!    if ( bpage )
!       ftype = IS_BPIPE;
! #endif
  
     if (fromatty) {
        j = 0;
        i = 1;
!       if ((pagerfp = OpenOutputFile(ftype, pager, TEXT_WRITE_MODE, &sigpipe)) 
! 	  == NULL )
  	 pagerfp = stdout;
        if (nRecents > 0) {
  	 j++;
*************** number of the site you want to connect t
*** 410,416 ****
  		}
  
  		if (pagerfp != stdout)
! 			(void) pclose(pagerfp);
  		Signal(SIGPIPE, sigpipe);
  	}
  }	/* PrintRecentSiteList */
--- 425,431 ----
        }
  
        if (pagerfp != stdout)
! 	 CloseOutputFile(pagerfp, ftype, NULL, 0);
        Signal(SIGPIPE, sigpipe);
     }
  }	/* PrintRecentSiteList */
*************** int ruserpass2(char *host, char **userna
*** 526,532 ****
  
  	site_found = 0;
  
! 	if ((fp = fopen(rcname, "r")) != NULL) {
  		parsing_rc = 1;
  		while (FGets(str, fp)) {
  			if ((cp = strstr(str, "machine")) != 0) {
--- 541,547 ----
  
  	site_found = 0;
  
! 	if ((fp = fopen(rcname, TEXT_READ_MODE)) != NULL) {
  		parsing_rc = 1;
  		while (FGets(str, fp)) {
  			if ((cp = strstr(str, "machine")) != 0) {
Only in .: getline
diff -pw ../orig/nc193/getpass.c ./getpass.c
*** ../orig/nc193/getpass.c	Sun Mar 05 13:56:34 1995
--- ./getpass.c	Tue Mar 07 22:04:32 1995
*************** char *Getpass(char *promptstr)
*** 120,125 ****
--- 120,133 ----
  	static char buf[kMaxPassLen + 1];
  
          /*
+ 	 * Not everyone has /dev/tty, so we'll simply use stdin and stderr
+ 	 * directly if PASS_USE_STD is defined.
+ 	 */
+ #ifdef PASS_USE_STD
+ 	fp = stdin;
+ 	outfp = stderr;
+ #else	
+ 	/*
  	 * read and write to /dev/tty if possible; else read from
  	 * stdin and write to stderr.
  	 */
*************** char *Getpass(char *promptstr)
*** 135,140 ****
--- 143,149 ----
  	if ((outfp = fopen("/dev/tty", "w")) == NULL)
  		outfp = stderr;
  #endif
+ #endif /* PASS_USE_STD */	
  	oldintr = Signal(SIGINT, SIG_IGN);
  	Echo(fp, 0);		/* Turn echoing off. */
  	(void) fputs(promptstr, outfp);
diff -pw ../orig/nc193/glob.c ./glob.c
*** ../orig/nc193/glob.c	Sun Mar 05 13:56:34 1995
--- ./glob.c	Tue Mar 07 22:04:36 1995
*************** void matchdir(char *pattern)
*** 216,223 ****
--- 216,225 ----
  			return;
  		goto patherr2;
  	}
+ #ifndef NO_FSTAT_DIR
  	if (fstat(dirp->dd_fd, &stb) < 0)
  		goto patherr1;
+ #endif	
  	if (!isdir(stb)) {
  		errno = ENOTDIR;
  		goto patherr1;
diff -pw ../orig/nc193/main.c ./main.c
*** ../orig/nc193/main.c	Sun Mar 05 13:56:34 1995
--- ./main.c	Sun Mar 12 16:26:38 1995
*************** extern char			*Optarg;
*** 131,136 ****
--- 131,142 ----
  extern string		gate_login;
  #endif
  
+ /* path-where-ncftp-lives globals */
+ #ifdef __EMX__
+ char glDrive[_MAX_DRIVE], glDir[_MAX_DIR];
+ char glFname[_MAX_FNAME], glExt[_MAX_EXT];
+ #endif
+ 
  void main(int argc, char **argv)
  {
     register char		*cp;
*************** void main(int argc, char **argv)
*** 138,150 ****
--- 144,167 ----
     string				tmp, oline;
     struct servent		*sptr;
  
+ #ifdef __EMX__
+    _wildcard(&argc,&argv);
+    _splitpath(argv[0],glDrive,glDir,glFname,glExt);
+ #endif
+    
     if ((cp = rindex(argv[0], '/'))) cp++;
     else cp = argv[0];
     (void) Strncpy(progname, cp);
  	
+ #ifndef dFTP_PORT
+    /* 
+     * if the FTP port number is specified, then we don't
+     * need to look up the service 
+     */
     sptr = getservbyname("ftp", "tcp");
     if (sptr == 0) fatal("ftp/tcp: unknown service");
     serv = *sptr;
+ #endif   
  
     if (init_arrays())			/* Reserve large blocks of memory now */
        fatal("could not reserve large amounts of memory.");
*************** Re-compile, this time with -DZCAT=\\\"/p
*** 189,194 ****
--- 206,212 ----
     /*	Setup our pager variable, before we run through the rc,
  	which may change it. */
     set_pager(getenv("PAGER"), 0);
+    (void) getuserinfo();
  #ifdef CURSES
     ansi_escapes = 1;
     termcap_init();
*************** Re-compile, this time with -DZCAT=\\\"/p
*** 200,206 ****
  			ansi_escapes = 1;
  	}
  #endif
- 	(void) getuserinfo();
  
  	/* Init the mailbox checking code. */
  	(void) time(&mbox_time);
--- 218,223 ----
*************** Examples:\n\
*** 330,336 ****
  	cpend = 0;  /* no pending replies */
  	
  	if (*logfname)
! 		logf = fopen (logfname, "a");
  
  
  	/* The user specified a host, maybe in 'colon-mode', on the command
--- 347,353 ----
  	cpend = 0;  /* no pending replies */
  	
  	if (*logfname)
! 		logf = fopen (logfname, APPEND_MODE);
  
  
  	/* The user specified a host, maybe in 'colon-mode', on the command
*************** For testing purposes only.  Do not re-di
*** 361,384 ****
  #else
  #	define BETA_MSG ""
  #endif
  
  #ifndef CURSES
! 		(void) printf("%sNcFTP %s by Mike Gleason, NCEMRSoft.%s%s%s%s\n", 
  			tcap_boldface,
  			FTP_VERSION,
  			tcap_normal,
  			tcap_reverse,
  			BETA_MSG,
  			tcap_normal
  		);
  #else
  		char vis[256];
! 		(void) sprintf(vis, "%sNcFTP %s by Mike Gleason, NCEMRSoft.%s%s%s%s\n", 
  			tcap_boldface,
  			FTP_VERSION,
  			tcap_normal,
  			tcap_reverse,
  			BETA_MSG,
  			tcap_normal
  		);
  		tcap_put(vis);
--- 378,410 ----
  #else
  #	define BETA_MSG ""
  #endif
+ #ifdef __EMX__
+ #       define MOD_MSG "\n  Modified for compatibility with OS/2 by "\
+                "Steve Willer <willer@io.org>"
+ #else
+ #       define MOD_MSG ""
+ #endif 
+ 	       
  
  #ifndef CURSES
! 		(void) printf("%sNcFTP %s by Mike Gleason, NCEMRSoft.%s%s%s%s%s\n", 
  			tcap_boldface,
  			FTP_VERSION,
  			tcap_normal,
  			tcap_reverse,
  			BETA_MSG,
+ 			MOD_MSG,
  			tcap_normal
  		);
  #else
  		char vis[256];
! 		(void) sprintf(vis, "%sNcFTP %s by Mike Gleason, NCEMRSoft.%s%s%s%s%s\n", 
  			tcap_boldface,
  			FTP_VERSION,
  			tcap_normal,
  			tcap_reverse,
  			BETA_MSG,
+ 			MOD_MSG,
  			tcap_normal
  		);
  		tcap_put(vis);
*************** void intr SIG_PARAMS
*** 412,417 ****
--- 438,495 ----
  }	/* intr */
  
  
+ #ifdef __EMX__
+ 
+ /* Thanks to Kai Uwe Rommel for sending me this. */
+ int gethostname(char *buffer, int size)
+ {
+   struct in_addr addr;
+   struct hostent *host;
+   
+   addr.s_addr = htonl(gethostid());
+   host = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
+ 
+   if ( host ) {
+     strncpy(buffer, host -> h_name, size);
+     buffer[size - 1] = 0;
+     return 0;
+   }
+   else {
+     buffer[0] = 0;
+     return 1;
+   }
+ }
+ 
+ int getuserinfo(void)
+ {
+   extern char *home; /* for glob.c */
+   longstring newenv;
+ 
+   home = uinfo.homedir;
+ 
+   strcpy( uinfo.username, getenv("USER")?getenv("USER"):"root" );
+   strcpy( uinfo.homedir,  getenv("HOME")?getenv("HOME"):"/" );
+   strcpy( uinfo.shell, getenv("SHELL")?getenv("SHELL"):getenv("COMSPEC") );
+   if ( gethostname(uinfo.hostname,sizeof(uinfo.hostname)) ) {
+     PERROR("getuserinfo","Could not identify the host name");
+   }
+   
+   /* if the termcap stuff isn't set, we'll try defaults */
+   if ( getenv("TERMCAP") == NULL ) {
+      strcpy(newenv,"TERMCAP=");
+      strcat(newenv,glDrive);
+      strcat(newenv,glDir);
+      strcat(newenv,"termcap.dat");
+      putenv(newenv);
+   }
+   if ( getenv("TERM") == NULL ) {
+      putenv("TERM=mono");
+   }
+      
+   mail_path[0] = '\0';
+ }
+   
+ #else
  
  int getuserinfo(void)
  {
*************** int getuserinfo(void)
*** 490,496 ****
  	}
  }	/* getuserinfo */
  
! 
  
  
  int init_arrays(void)
--- 568,574 ----
  	}
  }	/* getuserinfo */
  
! #endif /* __EMX__ */
  
  
  int init_arrays(void)
*************** S1:
*** 830,835 ****
--- 908,925 ----
  		goto OUT;	/* end of token */
  
  	case '\\':
+ #ifdef __EMX__
+ 	   if (*(sb+1) != ' ' &&
+ 		   *(sb+1) != '\t' &&
+ 		   *(sb+1) != '\n' &&
+ 		   *(sb+1) != '=' &&
+ 		   *(sb+1) != '\0') {
+ 			  *ap++ = *sb++;  /* add character to token */
+ 			  got_one = 1;
+ 			  goto S1;
+ 		   }
+ 	   else
+ #endif /* __EMX__ */	   	 
  	   	 sb++; goto S2;	/* slurp next character */
  
  	case '"':
*************** void trim_log(void)
*** 989,995 ****
  	string				tmplogname, str;
  
  	if (logsize <= 0 || *logfname == 0 || stat(logfname, &st) ||
! 		(old = fopen(logfname, "r")) == NULL)
  		return;	/* never trim, or no log */
  	fat = st.st_size - logsize;
  	if (fat <= 0L) return;	/* log too small yet */
--- 1079,1085 ----
  	string				tmplogname, str;
  
  	if (logsize <= 0 || *logfname == 0 || stat(logfname, &st) ||
! 		(old = fopen(logfname, READ_MODE)) == NULL)
  		return;	/* never trim, or no log */
  	fat = st.st_size - logsize;
  	if (fat <= 0L) return;	/* log too small yet */
*************** void trim_log(void)
*** 1010,1016 ****
  	/* copy the remaining lines in "old" to "new" */
  	(void) Strncpy(tmplogname, logfname);
  	tmplogname[strlen(tmplogname) - 1] = 'T';
! 	if ((new = fopen(tmplogname, "w")) == NULL) {
  		(void) PERROR("trim_log", tmplogname);
  		return;
  	}
--- 1100,1106 ----
  	/* copy the remaining lines in "old" to "new" */
  	(void) Strncpy(tmplogname, logfname);
  	tmplogname[strlen(tmplogname) - 1] = 'T';
! 	if ((new = fopen(tmplogname, WRITE_MODE)) == NULL) {
  		(void) PERROR("trim_log", tmplogname);
  		return;
  	}
Only in .: makedocs.btm
Only in .: makefile.os2
Only in .: ncftp.src
diff -pw ../orig/nc193/set.c ./set.c
*** ../orig/nc193/set.c	Sun Mar 05 13:56:34 1995
--- ./set.c	Sun Mar 12 23:19:04 1995
*************** extern int					tips;
*** 54,59 ****
--- 54,62 ----
  #ifdef GATEWAY
  extern string				gateway, gate_login;
  #endif
+ #ifdef HAS_BPAGE
+ int bpage = 0;
+ #endif
  
  /* The variables must be sorted in alphabetical order, or else
   * match_var() will choke.
*************** struct var vars[] = {
*** 63,75 ****
--- 66,83 ----
  	VARENTRY("anon-password",	STR,  0, anon_password,	NULL),
  	VARENTRY("ansi-escapes",	BOOL, 0, &ansi_escapes,	NULL),
  	VARENTRY("auto-binary",		BOOL, 0, &auto_binary,	NULL),
+ #ifdef HAS_BPAGE
+         VARENTRY("bpage",               BOOL, 0, &bpage,        NULL),
+ #endif
  #ifdef TERM_FTP
  	VARENTRY("compress",		INT,  0,
  		 &compress_toggle,NULL),
  #endif
  	VARENTRY("debug",			INT,  0, &debug,		NULL),
  #ifdef GATEWAY
+ #ifndef DYNGATEWAY   
  	VARENTRY("gateway-login",	STR,  0, gate_login,	set_gatelogin),
+ #endif   
  	VARENTRY("gateway-host",	STR,  0, gateway,		NULL),
  #endif
  	VARENTRY("local-dir",		STR,  0, lcwd,			set_ldir),
*************** void set_pager(char *new, int unset)
*** 154,159 ****
--- 162,170 ----
        if (!new[0])
  	 (void) Strncpy(pager, "-");
        else {
+ 	 if ( bpage )
+ 	    (void) sprintf(pager, "+%s", (*new == '|' ? new + 1 : new));
+ 	 else 
  	 (void) sprintf(pager, "|%s", (*new == '|' ? new + 1 : new));
  	 (void) LocalPath(pager + 1);
        }
diff -pw ../orig/nc193/sys.h ./sys.h
*** ../orig/nc193/sys.h	Sun Mar 05 13:56:34 1995
--- ./sys.h	Sun Mar 12 23:24:54 1995
***************
*** 7,12 ****
--- 7,45 ----
   *  $Date: 93/06/21 06:42:11 $
   */
  
+ #ifdef __EMX__ /* OS/2 */
+ #       define System "OS/2 32-bit w/TCP/IP"
+ #       define NO_UTIMEH
+ #       define BSD_SELECTC
+ #       define PASS_USE_STD
+ #       define HAS_GETCWD
+ #       define NO_FSTAT_DIR
+ #       define TRUNCATE_BAD_OPEN
+ #       define GETPASS
+ #       define CURSES
+ #       define TRY_ABOR
+ #       define HAS_BPAGE
+ #       define dRECENTF "~/ncrecent"
+ #       define dLOGNAME "~/ncftplog"
+ /*#       define GZCAT "gzip -dc" */
+ #       define WRITE_MODE "wb"
+ #       define READ_MODE "rb"
+ #       define APPEND_MODE "ab"
+ #       define TEXT_WRITE_MODE "w"
+ #       define TEXT_READ_MODE "r"
+ #       define dFTP_PORT 21
+ #       include <os2.h>
+ #       undef TRUE
+ #       undef FALSE
+ #       undef VOID
+ #else
+ #       define WRITE_MODE "w"
+ #       define READ_MODE "r"
+ #       define APPEND_MODE "a"
+ #       define TEXT_WRITE_MODE "w"
+ #       define TEXT_READ_MODE "r"
+ #endif
+ 
  
  #ifdef __sun
  #	ifndef sun
*************** extern int errno;
*** 519,524 ****
--- 552,565 ----
  /* Include frequently used headers: */
  
  #include <sys/types.h>
+ #ifdef __EMX__
+ #include <netinet/in.h>
+ #include <strings.h>
+ #endif
+ 
+ #ifdef FORTIFY
+ #include "fortify.h"
+ #endif
  
  #ifndef NO_SYSPARAM
  #include <sys/param.h>
diff -pw ../orig/nc193/tips.c ./tips.c
*** ../orig/nc193/tips.c	Sun Mar 05 13:56:34 1995
--- ./tips.c	Mon Mar 13 00:22:04 1995
*************** static char *tiplist[] = {
*** 89,104 ****
--- 89,115 ----
       and/or use EMACS-style (or maybe VI-style) commands to edit the line.",
  #endif
  
+ #ifdef __EMX__
+     "You can get the newest version of the OS/2 port of NcFTP from hobbes.\n\
+      Simply type 'ncftp ftp://hobbes.nmsu.edu/os2/network/tcpip/ncftp.zip'\n\
+      to retrieve the latest version.",
+ #else
      "You can get the newest version of NcFTP from ftp.cs.unl.edu, in the\n\
       /pub/ncftp directory, AFTER business hours.",
+ #endif
  
      "The type of progress-meter that will be used depends if the remote host\n\
       supports the SIZE command, and whether your terminal is capable of ANSI\n\
       escape codes.",
  
+ #ifdef __EMX__
+     "To report a bug, mail your message to willer@io.org. Include the output\n\
+      of the 'version' command in your message.",
+ #else
      "To report a bug, mail your message to mgleason@cse.unl.edu.  Include the\n\
       output of the 'version' command in your message.  An easy way to do that\n\
       is to compose your message, then do a 'ncftp -H >> msg.'",
+ #endif
  
      "Don't put a site in your .ncftprc unless you want an 'init' macro.  The \n\
       recent-file saves sites with the last directory you were in, unlike \n\
*************** static char *tiplist[] = {
*** 107,112 ****
--- 118,129 ----
      "You can use World Wide Web style paths instead of colon-mode paths.\n\
       For example, if the colon-mode path was 'ftp.cs.unl.edu:pub/ncftp',\n\
       the WWW-style path would be 'ftp://ftp.cs.unl.edu/pub/ncftp'.",
+ 
+ #ifdef HAS_BPAGE
+     "This version of NcFTP has 'background-paging' installed. This allows you\n\
+      to automatically launch your pager in a new window. Read the documentation\n\
+      for further information.",
+ #endif
  
      "Sick and tired of these tips?  Put '#unset tips' in your .ncftprc."
  };
diff -pw ../orig/nc193/util.c ./util.c
*** ../orig/nc193/util.c	Sun Mar 05 13:56:34 1995
--- ./util.c	Wed Mar 08 00:48:56 1995
*************** extern char *getwd(char *);
*** 599,604 ****
--- 599,607 ----
  
  char *get_cwd(char *buf, int size)
  {
+ #ifdef __EMX__
+    return(_getcwd2(buf,size-1));
+ #else   
  #ifdef HAS_GETCWD
  #   ifdef NO_UNISTDH
  #      ifdef GETCWDSIZET
*************** char *get_cwd(char *buf, int size)
*** 622,634 ****
--- 625,645 ----
          getwd(cwdbuf);
          return (_Strncpy(buf, cwdbuf, (size_t)size));
  #endif
+ #endif /* __EMX__ */   
  }   /* get_cwd */
  
  
  
  int tmp_name(char *str)
  {
+ #ifdef __EMX__
+         *str = '\0';
+    if ( getenv("TEMP") )
+      strcpy(str, getenv("TEMP"));
+    strcat(str, "/ncXXXXXX");
+ #else
     (void) strcpy(str, "/tmp/ncftpXXXXXX");
+ #endif
     return (!mktemp(str));
  }   /* tmp_name */
  
