diff -cb orig/basic.c new/basic.c
*** orig/basic.c	Fri Nov 22 19:03:22 1991
--- new/basic.c	Mon Jan 06 15:28:10 1992
***************
*** 35,41 ****
  * the beginning of the buffer.
  */
  bool backchar (f, n, k)
! register int    n;
  {
  	if (n < 0)
  		return (forwchar (f, -n, KRANDOM));
--- 35,41 ----
  * the beginning of the buffer.
  */
  bool backchar (f, n, k)
! register int  f, n, k;
  {
  	if (n < 0)
  		return (forwchar (f, -n, KRANDOM));
***************
*** 68,74 ****
  * from the end of the buffer.
  */
  bool forwchar (f, n, k)
! register int    n;
  {
  	if (n < 0)
  		return (backchar (f, -n, KRANDOM));
--- 68,74 ----
  * from the end of the buffer.
  */
  bool forwchar (f, n, k)
! register int f, n, k;
  {
  	if (n < 0)
  		return (backchar (f, -n, KRANDOM));
***************
*** 309,314 ****
--- 309,315 ----
  * the goal column is set.
  */
  bool forwline (f, n, k)
+ int f, n, k;
  {
  	if (n < 0)
  		return (backline (f, -n, KRANDOM));
***************
*** 338,343 ****
--- 339,345 ----
  * call "movedot" to perform the motion.
  */
  bool backline (f, n, k)
+ int f, n, k;
  {
  	if (n < 0)
  		return (forwline (f, -n, KRANDOM));
***************
*** 366,372 ****
  *       to same position on new page.
  */
  bool forwpage (f, n, k)
! register int    n;
  {
  	long    mov_lines;
  
--- 368,374 ----
  *       to same position on new page.
  */
  bool forwpage (f, n, k)
! register int f, n, k;
  {
  	long    mov_lines;
  
***************
*** 403,409 ****
  * but it goes backwards.
  */
  bool backpage (f, n, k)
! register int    n;
  {
  	long    mov_lines;
  
--- 405,411 ----
  * but it goes backwards.
  */
  bool backpage (f, n, k)
! register int f, n, k;
  {
  	long    mov_lines;
  
***************
*** 490,495 ****
--- 492,498 ----
  * to use.
  */
  bool gotoline (f, n, k)
+ int f, n, k;
  {
  	A32      index;
  	register int    s;
diff -cb orig/buffer.c new/buffer.c
*** orig/buffer.c	Fri Nov 22 19:03:20 1991
--- new/buffer.c	Mon Jan 06 15:28:12 1992
***************
*** 503,508 ****
--- 503,509 ----
  */
  BUFFER * bfind (bname, cflag)
  register char  *bname;
+ int cflag;
  {
  	register    BUFFER * bp;
  
diff -cb orig/def.h new/def.h
*** orig/def.h	Fri Nov 22 19:03:18 1991
--- new/def.h	Mon Jan 06 15:28:12 1992
***************
*** 49,55 ****
  #define     bool char       /* used for boolean values      */
  #define     bits char       /* used for boolean bit flags   */
  
! /* this define is reserved for the byte location in the a LINE structure */
  #define     LPOS uint       /* this is a 32 bit address into the buffer */
  
  /*
--- 49,55 ----
  #define     bool char       /* used for boolean values      */
  #define     bits char       /* used for boolean bit flags   */
  
! /* this define is reserved for the byte location in a LINE structure */
  #define     LPOS uint       /* this is a 32 bit address into the buffer */
  
  /*
***************
*** 87,92 ****
--- 87,94 ----
  #define	ANSI	1			/* send ANSI escape codes */
  #endif
  
+ #define NMAXROW 128         /* Rows.for boot    */
+ #define NMAXCOL 132
  #ifdef UNIX
  #define NROW	100
  #define NCOL    80          /* Columns.         */
***************
*** 106,112 ****
   * Table sizes, etc.
   */
  #define NSHASH  31          /* Symbol table hash size.      */
! #define NFILEN  80          /* Length, file name.           */
  #define NBUFN   13          /* Length, buffer name.     */
  #define NFILE   12          /* Length, file name.  */ /* krw */
  #define NKBDM   256         /* Length, keyboard macro.      */
--- 108,114 ----
   * Table sizes, etc.
   */
  #define NSHASH  31          /* Symbol table hash size.      */
! #define NFILEN  256         /* Length, file name.           */
  #define NBUFN   13          /* Length, buffer name.     */
  #define NFILE   12          /* Length, file name.  */ /* krw */
  #define NKBDM   256         /* Length, keyboard macro.      */
***************
*** 199,205 ****
   * between "getkey" and "getkbd" easier. The funny keys get
   * mapped into the C1 control area.
   */
! #define NKEYS   2048                    /* 11 bit code.                 */
  
  #define METACH  0x1B                    /* M- prefix,   Control-[, ESC  */
  #define CTMECH  0x1C                    /* C-M- prefix, Control-\       */
--- 201,207 ----
   * between "getkey" and "getkbd" easier. The funny keys get
   * mapped into the C1 control area.
   */
! #define NKEYS   4096                    /* 12 bit code.                 */
  
  #define METACH  0x1B                    /* M- prefix,   Control-[, ESC  */
  #define CTMECH  0x1C                    /* C-M- prefix, Control-\       */
diff -cb orig/display.c new/display.c
*** orig/display.c	Fri Nov 22 19:03:16 1991
--- new/display.c	Mon Jan 06 15:53:34 1992
***************
*** 99,105 ****
  	short   v_flag;             /* Flag word.                   */
  	short   v_color;            /* Color of the line.           */
  	XSHORT v_cost;      /* Cost of display.     */
! 	char    v_text[NCOL];       /* The actual characters.       */
  }                   VIDEO;
  
  #define VFCHG   0x0001          /* Changed.                     */
--- 99,105 ----
  	short   v_flag;             /* Flag word.                   */
  	short   v_color;            /* Color of the line.           */
  	XSHORT v_cost;      /* Cost of display.     */
! 	char    v_text[NMAXCOL];       /* The actual characters.       */
  }                   VIDEO;
  
  #define VFCHG   0x0001          /* Changed.                     */
***************
*** 130,138 ****
  int     ttbot = HUGE;           /* Bottom of scroll region.     */
  char    file_off_bad = FALSE;   /* Have file offsets been changed */
  
! VIDEO * vscreen[NROW];          /* Edge vector, virtual.        */
! VIDEO * pscreen[NROW];          /* Edge vector, physical.       */
! VIDEO video[2 * (NROW)];        /* Actual screen data.          */
  VIDEO blanks;                   /* Blank line image.            */
  
  /*
--- 130,138 ----
  int     ttbot = HUGE;           /* Bottom of scroll region.     */
  char    file_off_bad = FALSE;   /* Have file offsets been changed */
  
! VIDEO * vscreen[NMAXROW];       /* Edge vector, virtual.        */
! VIDEO * pscreen[NMAXROW];       /* Edge vector, physical.       */
! VIDEO video[2 * (NMAXROW)];     /* Actual screen data.          */
  VIDEO blanks;                   /* Blank line image.            */
  
  /*
***************
*** 154,160 ****
  	ttopen ();
  	ttinit ();
  	vp = &video[0];
! 	for (i = 0; i < NROW; ++i)
  	{
  		vscreen[i] = vp;
  		++vp;
--- 154,160 ----
  	ttopen ();
  	ttinit ();
  	vp = &video[0];
!     for (i = 0; i < NMAXROW; ++i)
  	{
  		vscreen[i] = vp;
  		++vp;
***************
*** 162,168 ****
  		++vp;
  	}
  	blanks.v_color = CTEXT;
! 	for (i = 0; i < NCOL; ++i)
  		blanks.v_text[i] = ' ';
  }
  
--- 162,168 ----
  		++vp;
  	}
  	blanks.v_color = CTEXT;
! 	for (i = 0; i < NMAXCOL; ++i)
  		blanks.v_text[i] = ' ';
  }
  
***************
*** 192,197 ****
--- 192,198 ----
  * more efficient. No checking for errors.
  */
  void vtmove (row, col)
+ int row, col;
  {
  	vtrow = row;
  	vtcol = col;
***************
*** 221,227 ****
  		if (ISCTRL (c) != FALSE)
  		{
  			vtputc ('^');
! 			vtputc (c ^ 0x40);
  		}
  		else
  		{
--- 222,228 ----
  		if (ISCTRL (c) != FALSE)
  		{
  			vtputc ('^');
! 			vtputc ((char) (c ^ 0x40));
  		}
  		else
  		{
***************
*** 929,934 ****
--- 930,936 ----
  * reverse video works on most terminals.
  */
  void uline (row, vvp, pvp)
+ int row;
  VIDEO * vvp;
  VIDEO * pvp;
  {
diff -cb orig/echo.c new/echo.c
*** orig/echo.c	Fri Nov 22 19:03:26 1991
--- new/echo.c	Mon Jan 06 15:28:16 1992
***************
*** 97,102 ****
--- 97,103 ----
  char    eread (fp, buf, nbuf, flag, ap)
  char   *fp;
  char   *buf;
+ int	nbuf, flag;
  char   *ap;
  {
  
***************
*** 194,199 ****
--- 195,201 ----
  			quote_flag = 1;
  			break;
  		case (KCTRL | 'M'): /* Return, done.    */
+                 case (KCTRL | 'J'): /* Linefeed, done.    */
  			buf[cpos] = '\0';
  			if (kbdmip != NULL)
  			{
***************
*** 291,296 ****
--- 293,299 ----
  int     getxtra (sp1, sp2, cpos)
  SYMBOL * sp1;
  SYMBOL * sp2;
+ int cpos;
  {
  
  	register int    i;
diff -cb orig/extend.c new/extend.c
*** orig/extend.c	Fri Nov 22 19:03:22 1991
--- new/extend.c	Mon Jan 06 15:29:44 1992
***************
*** 94,99 ****
--- 94,100 ----
  * Print an error if there is anything wrong.
  */
  char    extend (f, n, k)
+ int f, n, k;
  {
  
  	register    SYMBOL * sp;
***************
*** 200,205 ****
--- 201,207 ----
  * "ins-self" are only displayed if there is an argument.
  */
  char    wallchart (f, n, k)
+ int f, n, k;
  {
  
  	register char   s;
diff -cb orig/file.c new/file.c
*** orig/file.c	Fri Nov 22 19:03:16 1991
--- new/file.c	Mon Jan 06 15:29:48 1992
***************
*** 12,17 ****
--- 12,18 ----
  bool    writeout ();
  bool    parse_f_name ();
  A32	ffseek ();
+ A32     file_len();
  
  extern    char    MSG_rd_file[];
  extern    char    MSG_trash[];
***************
*** 125,130 ****
--- 126,132 ----
  * file-vist with auto window split, and readonly (view-file) (jam)
  */
  char    file_visit (f, n, k)
+ int f, n, k;
  {
  	char    fname[NFILEN];
  	char    s;
diff -cb orig/fileio.c new/fileio.c
*** orig/fileio.c	Fri Nov 22 19:03:18 1991
--- new/fileio.c	Mon Jan 06 15:59:34 1992
***************
*** 11,17 ****
--- 11,20 ----
  #include	<sys/types.h>
  #include	<fcntl.h>
  #include	<sys/stat.h>
+ #ifndef O_BINARY
+ #define O_BINARY 0
  #endif
+ #endif
  #include        "def.h"
  
  extern    char    MSG_cnt_wr[];
***************
*** 47,53 ****
  	return (FIOSUC);
  #endif
  #ifdef UNIX
! 	if ((ffp = open (fn, O_RDONLY)) == -1)/* pvr */
  		return (FIOERR);
  	;
  	return (FIOSUC);
--- 50,56 ----
  	return (FIOSUC);
  #endif
  #ifdef UNIX
!         if ((ffp = open (fn, O_RDONLY | O_BINARY)) == -1)/* pvr */
  		return (FIOERR);
  	;
  	return (FIOSUC);
***************
*** 105,110 ****
--- 108,120 ----
  	}
  	return (FIOSUC);
  #endif
+ #ifdef OS2
+         if ((ffp = open (fn, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
+                          mode)) == -1)/* pvr */
+ 		return (FIOERR);
+ 	;
+ 	return (FIOSUC);
+ #else /* OS2 has UNIX set too */
  #ifdef UNIX
  	/* set perms as in original file 1.31 */
  	if ((ffp = open (fn, O_WRONLY | O_CREAT, mode)) == -1)/* pvr */
***************
*** 112,117 ****
--- 122,128 ----
  	;
  	return (FIOSUC);
  #endif
+ #endif /* OS2 */
  #ifdef AMIGA
  	/* set perms as in original file 1.31 */
  	if ((ffp = open (fn, O_WRONLY | O_CREAT, mode)) == -1)/* pvr */
***************
*** 248,254 ****
  	source = fname;
  	backup = backname;
  	while ((*source > 0)
! #ifdef MSDOS
  	    && (*source != '.'))
  #else
  		)
--- 259,265 ----
  	source = fname;
  	backup = backname;
  	while ((*source > 0)
! #if defined(MSDOS) || defined(OS2)
  	    && (*source != '.'))
  #else
  		)
diff -cb orig/kbd.c new/kbd.c
*** orig/kbd.c	Fri Nov 22 19:03:26 1991
--- new/kbd.c	Mon Jan 06 15:29:50 1992
***************
*** 115,121 ****
  		return;
  	}
  #endif
! 	if (k & 0x80)
  	{
  		if ((np = keystrings (k)) != NULL)
  		{
--- 115,121 ----
  		return;
  	}
  #endif
!     if (k & 0x800)
  	{
  		if ((np = keystrings (k)) != NULL)
  		{
diff -cb orig/line.c new/line.c
*** orig/line.c	Fri Nov 22 19:03:20 1991
--- new/line.c	Mon Jan 06 15:29:52 1992
***************
*** 229,234 ****
--- 229,235 ----
  * if all is well, and FALSE on errors.
  */
  bool linsert (n, c)
+ int	n;
  uchar   c;
  {
  	register D8    *cp1;
***************
*** 335,340 ****
--- 336,342 ----
  */
  bool ldelete (n_bytes, kflag)
  A32	n_bytes;
+ int	kflag;
  {
  	register LINE  *dotp, *lp, *lp_prev, *lp_next;
  	register LPOS  doto, l_cnt;
***************
*** 402,408 ****
  	{   /* wholesale delete by moving lines to save buffer */
  		if (doto != 0)
  		{
! 			if ((lp = l_break_in_two (dotp, doto, 0l)) == NULL)
  				return (FALSE);
  		}
  		else
--- 404,410 ----
  	{   /* wholesale delete by moving lines to save buffer */
  		if (doto != 0)
  		{
! 			if ((lp = l_break_in_two (dotp, doto, 0)) == NULL)
  				return (FALSE);
  		}
  		else
***************
*** 417,423 ****
  			if (n_byt < lp -> l_used)
  			{
  				/* get last piece of a line */
! 				lp_next = l_break_in_two (lp, n_byt, 0l);
  			}
  			n_byt -= lp -> l_used;
  			if (kflag)
--- 419,425 ----
  			if (n_byt < lp -> l_used)
  			{
  				/* get last piece of a line */
! 				lp_next = l_break_in_two (lp, (LPOS) n_byt, 0);
  			}
  			n_byt -= lp -> l_used;
  			if (kflag)
***************
*** 546,552 ****
  	}
  	else if (plen < rlen)
  	{
! 		if (linsert (rlen - plen, ' ') == FALSE)
  			return (FALSE);
  	}
  	curwp -> w_doto = doto;
--- 548,554 ----
  	}
  	else if (plen < rlen)
  	{
! 		if (linsert (rlen - plen, (uchar) ' ') == FALSE)
  			return (FALSE);
  	}
  	curwp -> w_doto = doto;
diff -cb orig/main.c new/main.c
*** orig/main.c	Fri Nov 22 19:03:22 1991
--- new/main.c	Mon Jan 06 15:36:54 1992
***************
*** 48,53 ****
--- 48,56 ----
  extern    char    MSG_ok[];
  extern    char    MSG_main[];
  extern    char    MSG_prog_name[];
+ extern    char    MSG_init_file[];
+ extern    char    MSG_init_var[];
+ extern    char    MSG_init_path[];
  extern    char    MSG_no_mod[];
  extern    char    MSG_no_s_chg[];
  extern    char    MSG_auto_fl[];
***************
*** 92,97 ****
--- 95,101 ----
  int     auto_update = 0;
  
  void main (argc, argv)
+ int     argc;
  char   *argv[];
  {
  
***************
*** 100,105 ****
--- 104,110 ----
  	register    int     n;
  	register    int     mflag;
  	char        bname[NBUFN];
+ 	char        initfile[NFILEN];
  
  #if MSDOS
  	is_wang ();                 /* Check for computer type */
***************
*** 144,150 ****
--- 149,169 ----
  		initial_load = 0;
  	}
  
+ #ifdef OS2
+         _searchenv(MSG_init_file, MSG_init_var, initfile);
+         if ( initfile[0] )
+            check_extend (initfile);
+         else
+         {
+           _searchenv(MSG_init_file, MSG_init_path, initfile);
+           if ( initfile[0] )
+              check_extend (initfile);
+           else
+              check_extend (getenv (MSG_prog_name));
+         }
+ #else
  	check_extend (NULL);  /* check for extended keys */
+ #endif
  	save_buf_init();		/* initialize save buffer */
  	lastflag = 0;               /* Fake last flags.     */
  
***************
*** 211,216 ****
--- 230,236 ----
  * entry now). Also fiddle with the flags.
  */
  char    execute (c, f, n)
+ int c, f, n;
  {
  
  	register    SYMBOL * sp;
***************
*** 328,333 ****
--- 348,354 ----
  * and quit
  */
  bool flushnquit (f, n, k)
+ int f, n, k;
  {
  	flush_all ();
  	quit (f, n, k);
***************
*** 342,347 ****
--- 363,369 ----
  * to "C-X C-C".
  */
  char    quit (f, n, k)
+ int f, n, k;
  {
  
  	register char   s;
***************
*** 366,371 ****
--- 388,394 ----
  * variables and return.
  */
  bool ctlxlp (f, n, k)
+ int f, n, k;
  {
  
  	if (kbdmip != NULL || kbdmop != NULL)
***************
*** 388,393 ****
--- 411,417 ----
  * and return to the caller.
  */
  bool ctlxrp (f, n, k)
+ int f, n, k;
  {
  
  	if (kbdmip == NULL)
***************
*** 412,417 ****
--- 436,442 ----
  * FALSE.
  */
  bool ctlxe (f, n, k)
+ int f, n, k;
  {
  
  	register int    c;
***************
*** 463,468 ****
--- 488,494 ----
  * stuff.
  */
  char    ctrlg (f, n, k)
+ int f, n, k;
  {
  	/*    ttbeep (); */
  	if (kbdmip != NULL)
***************
*** 481,486 ****
--- 507,513 ----
  * Don't call display if there is an argument.
  */
  char    showversion (f, n, k)
+ int f, n, k;
  {
  	static  char    *cp;
  	char    buf[NCOL];
diff -cb orig/random.c new/random.c
*** orig/random.c	Fri Nov 22 19:03:20 1991
--- new/random.c	Mon Jan 06 15:37:52 1992
***************
*** 76,81 ****
--- 76,82 ----
  * This is normally bound to "C-X =".
  */
  bool showcpos (f, n, k)
+ int f, n, k;
  {
  
  	A32     dotoff,
***************
*** 192,197 ****
--- 193,199 ----
  * regularity.
  */
  bool quote (f, n, k)
+ int f, n, k;
  {
  	register int    c;
  
***************
*** 218,224 ****
  	if (n == 0)
  		return (TRUE);
  
! 	return (linsert (n, c));
  }
  
  /*
--- 220,226 ----
  	if (n == 0)
  		return (TRUE);
  
! 	return (linsert (n, (uchar) c));
  }
  
  /*
***************
*** 254,259 ****
--- 256,262 ----
  */
  
  bool selfinsert (f, n, k)
+ int f, n, k;
  {
  
  	register int    c;
***************
*** 302,317 ****
  	switch (curwp -> w_fmt_ptr -> r_type)
  	{
  	case EBCDIC:
! 		c = to_ebcdic (c);  /* convert ASCII to EBCDIC */
  	case ASCII:
  		if ((insert_mode) || (DOT_POS(curwp) == BUF_SIZE(curwp)))
  		{
! 			linsert (n, c);
  			if (read_pat_mode)
  				forwchar (0, 1, KRANDOM);/* advance the cursor */
  		}
  		else
! 			lreplace (n, c);
  		break;
  
  	case HEX:
--- 305,320 ----
  	switch (curwp -> w_fmt_ptr -> r_type)
  	{
  	case EBCDIC:
! 		c = to_ebcdic ((char) c);  /* convert ASCII to EBCDIC */
  	case ASCII:
  		if ((insert_mode) || (DOT_POS(curwp) == BUF_SIZE(curwp)))
  		{
! 			linsert (n, (uchar) c);
  			if (read_pat_mode)
  				forwchar (0, 1, KRANDOM);/* advance the cursor */
  		}
  		else
! 			lreplace (n, (char) c);
  		break;
  
  	case HEX:
***************
*** 494,500 ****
  		{
  		case BYTES:
  			sprintf (text_buf, MSG_03u, (int) (edt_buf[0] & 0xff));
! 			if (!dec_chr_ok (text_buf, max_dec_8, c, u_offs))
  			{
  				bad_key (k);
  				return (TRUE);  /* TRUE so that mask will be same len */
--- 497,503 ----
  		{
  		case BYTES:
  			sprintf (text_buf, MSG_03u, (int) (edt_buf[0] & 0xff));
! 			if (!dec_chr_ok (text_buf, max_dec_8, (char) c, u_offs))
  			{
  				bad_key (k);
  				return (TRUE);  /* TRUE so that mask will be same len */
***************
*** 506,512 ****
  		case WORDS:
  			l_val = get_int (edt_buf);/* do intel swap */
  			sprintf (text_buf, MSG_05u, (int) (l_val & 0xFFFF));
! 			if (!dec_chr_ok (text_buf, max_dec_16, c, u_offs))
  			{
  				bad_key (k);
  				return (TRUE);  /* TRUE so that mask will be same len */
--- 509,515 ----
  		case WORDS:
  			l_val = get_int (edt_buf);/* do intel swap */
  			sprintf (text_buf, MSG_05u, (int) (l_val & 0xFFFF));
! 			if (!dec_chr_ok (text_buf, max_dec_16, (char) c, u_offs))
  			{
  				bad_key (k);
  				return (TRUE);  /* TRUE so that mask will be same len */
***************
*** 519,525 ****
  		case DWORDS:
  			l_val = get_long (edt_buf);/* do intel swap */
  			sprintf (text_buf, MSG_010lu, l_val);
! 			if (!dec_chr_ok (text_buf, max_dec_32, c, u_offs))
  			{
  				bad_key (k);
  				return (TRUE);  /* TRUE so that mask will be same len */
--- 522,528 ----
  		case DWORDS:
  			l_val = get_long (edt_buf);/* do intel swap */
  			sprintf (text_buf, MSG_010lu, l_val);
! 			if (!dec_chr_ok (text_buf, max_dec_32, (char) c, u_offs))
  			{
  				bad_key (k);
  				return (TRUE);  /* TRUE so that mask will be same len */
***************
*** 568,573 ****
--- 571,577 ----
  *   Insert one unit of zeros at the current dot position.
  */
  bool    insertunit (f, n, k)
+ int f, n, k;
  {
  	lchange (WFEDIT);
  	linsert ((R_B_PER_U(curwp) * n), 0);
***************
*** 629,640 ****
  */
  
  char    dec_chr_ok (char_buf, max_str, chr, pos)
! 
! char    chr,
! pos,
! *char_buf,
! *max_str;
! 
  {
  	char    i;
  
--- 633,640 ----
  */
  
  char    dec_chr_ok (char_buf, max_str, chr, pos)
! char    chr, pos;
! char	*char_buf, *max_str;
  {
  	char    i;
  
***************
*** 812,817 ****
--- 812,818 ----
  * from the correct offset.
  */
  bool dispshift (f, n, k)
+ int f, n, k;
  {
  	char    mode,
  	size;
***************
*** 865,870 ****
--- 866,872 ----
  * Normally bound to "C-D".
  */
  char    forwdel (f, n, k)
+ int f, n, k;
  {
  	char    s;
  
***************
*** 896,901 ****
--- 898,904 ----
  * if presented with an argument.
  */
  char    backdel (f, n, k)
+ int f, n, k;
  {
  
  	int     u_off;
***************
*** 1064,1069 ****
--- 1067,1073 ----
  * in the way that the INTEL microprocessors do it.
  */
  bool dispswapbyte (f, n, k)
+ int f, n, k;
  {
  	if ((curwp -> w_fmt_ptr -> r_size) == BYTES)
  		return (TRUE);
***************
*** 1089,1094 ****
--- 1093,1099 ----
  * text landed off screen).
  */
  bool yank (f, n, k)
+ int f, n, k;
  {
  	register D16    c;
  	register A32    i;
***************
*** 1102,1108 ****
  		save_buf_home ();
  		while ((c = get_save_char ()) != (D16)-1)
  		{
! 			if (linsert (1, c) == FALSE)
  				return (FALSE);
  			if ((i & 0x2ff) == 0)
  			{
--- 1107,1113 ----
  		save_buf_home ();
  		while ((c = get_save_char ()) != (D16)-1)
  		{
! 			if (linsert (1, (uchar) c) == FALSE)
  				return (FALSE);
  			if ((i & 0x2ff) == 0)
  			{
***************
*** 1179,1184 ****
--- 1184,1190 ----
   *	image files from odd and even bytes into one file.
   */
  bool	n_way_combine (f, n, k)
+ int     f, n, k;
  {
  	WINDOW * dest_wp, *src_wp;
  	BUFFER *src_bp;
***************
*** 1264,1269 ****
--- 1270,1276 ----
   *	image files.
   */
  bool	n_way_split (f, n, k)
+ int     f, n, k;
  {
  	WINDOW  *src_wp;
  	A32     b_size;
***************
*** 1355,1357 ****
--- 1362,1365 ----
  		nextwind();
  	}    while (wp != curwp);
  }
+ 
diff -cb orig/region.c new/region.c
*** orig/region.c	Fri Nov 22 19:03:26 1991
--- new/region.c	Mon Jan 06 15:30:00 1992
***************
*** 23,28 ****
--- 23,29 ----
  * Move "." to the start, and kill the characters.
  */
  char    killregion (f, n, k)
+ int f, n, k;
  {
  	register char   s;
  	REGION region;
***************
*** 52,57 ****
--- 53,59 ----
  * by a yank.
  */
  char    copyregion (f, n, k)
+ int f, n, k;
  {
  	register    LINE * linep;
  	register int    loffs, j;
***************
*** 69,75 ****
  	loffs = region.r_offset;    /* Current offset.  */
  	while (region.r_size--)
  	{
! 		if ((s = b_append_c (&sav_buf, lgetc (linep, loffs))) != TRUE)
  			return (s);
  		++loffs;
  		if ((j++ & 0x2ff) == 0)
--- 71,77 ----
  	loffs = region.r_offset;    /* Current offset.  */
  	while (region.r_size--)
  	{
! 		if ((s = b_append_c (&sav_buf, (uchar) lgetc (linep, loffs))) != TRUE)
  			return (s);
  		++loffs;
  		if ((j++ & 0x2ff) == 0)
***************
*** 140,145 ****
--- 142,148 ----
  * and doesn't do clever things at all with dot in destination buffer!
  */
  char    save_region (f, n, k)
+ int f, n, k;
  {
  	char    bufn[NBUFN];
  	char    oldbufn[NBUFN];
diff -cb orig/search.c new/search.c
*** orig/search.c	Fri Nov 22 19:03:18 1991
--- new/search.c	Mon Jan 06 15:30:02 1992
***************
*** 230,235 ****
--- 230,236 ----
  * (note typical hack to add a function with minimal code)
  */
  char    queryrepl (f, n, k)
+ int f, n, k;
  {
  
  	register char   s;
***************
*** 645,651 ****
  
  		cod = getkey ();
  
! 		if (cod == 0x014D)  /* check for return */
  		{
  			if ((rplc_mode == TRUE) && (cur_prompt == MSG_sch_str))
  			{
--- 646,652 ----
  
  		cod = getkey ();
  
! 	        if (cod == 0x014D || cod == 0x014A)  /* check for return or linefeed */
  		{
  			if ((rplc_mode == TRUE) && (cur_prompt == MSG_sch_str))
  			{
diff -cb orig/spawn.c new/spawn.c
*** orig/spawn.c	Fri Nov 22 19:03:20 1991
--- new/spawn.c	Mon Jan 06 15:39:46 1992
***************
*** 3,8 ****
--- 3,12 ----
  */
  #include        "def.h"
  
+ #ifdef OS2
+ #define MSDOS  1
+ #endif
+ 
  extern    char    MSG_shell[];
  extern    char    MSG_def_shell[];
  extern    char    MSG_pmpt[];
***************
*** 11,17 ****
  extern    char    MSG_null[];
  
  /* #include     <dos.h> */
! #if MSDOS
  #include        "process.h"
  #endif
  char   *cspec = NULL;           /* Command string.      */
--- 15,21 ----
  extern    char    MSG_null[];
  
  /* #include     <dos.h> */
! #ifdef MSDOS
  #include        "process.h"
  #endif
  char   *cspec = NULL;           /* Command string.      */
***************
*** 24,40 ****
  * garbage so that you do a full repaint.
  */
  bool spawncli (f, n, k)
  {
! #if MSDOS
  
  	char   *getenv ();
  	char    old_prompt[NCOL];
  	char    prompt_line[NCOL];
  
  	ttcolor (CTEXT);            /* Normal color.        */
  	ttmove (nrow - 1, 0);       /* Last line.           */
  	ttflush ();
  	ttcooked ();
  #ifndef IBM
  	strcpy (prompt_line, MSG_pmpt);
  	pspec = getenv (MSG_pt);
--- 28,48 ----
  * garbage so that you do a full repaint.
  */
  bool spawncli (f, n, k)
+ int f, n, k;
  {
! #ifdef MSDOS
  
  	char   *getenv ();
+ #ifndef OS2
  	char    old_prompt[NCOL];
  	char    prompt_line[NCOL];
+ #endif
  
  	ttcolor (CTEXT);            /* Normal color.        */
  	ttmove (nrow - 1, 0);       /* Last line.           */
  	ttflush ();
  	ttcooked ();
+ #ifndef OS2
  #ifndef IBM
  	strcpy (prompt_line, MSG_pmpt);
  	pspec = getenv (MSG_pt);
***************
*** 51,62 ****
--- 59,73 ----
  			exit (1);
  
  #endif
+ #endif
  	if (!cspec && !(cspec = getenv (MSG_shell)))/* jam */
  		cspec = MSG_def_shell;
  	spawnl (P_WAIT, cspec, MSG_null, NULL);
+ #ifndef OS2
  	putenv (MSG_pme);
  	if (putenv (old_prompt) == -1)
  		exit (1);
+ #endif
  	ttraw ();
  	sgarbf = TRUE;
  #endif
diff -cb orig/symbol.c new/symbol.c
*** orig/symbol.c	Fri Nov 22 19:03:20 1991
--- new/symbol.c	Mon Jan 06 15:30:04 1992
***************
*** 426,432 ****
  	for (i = 0; i < NKEYS; ++i)
  		binding[i] = NULL;
  	for (kp = &key[0]; kp < &key[NKEY]; ++kp)
! 		keyadd (kp -> k_key, kp -> k_funcp, kp -> k_name, kp -> k_modify);
  	keydup (KCTLX | KCTRL | 'G', MSG_abort);
  	keydup (KMETA | KCTRL | 'G', MSG_abort);
  	keydup (0x7F, MSG_back_del_char);
--- 428,434 ----
  	for (i = 0; i < NKEYS; ++i)
  		binding[i] = NULL;
  	for (kp = &key[0]; kp < &key[NKEY]; ++kp)
!         keyadd (kp -> k_key, (bool (*)()) kp -> k_funcp, kp -> k_name, kp -> k_modify);
  	keydup (KCTLX | KCTRL | 'G', MSG_abort);
  	keydup (KMETA | KCTRL | 'G', MSG_abort);
  	keydup (0x7F, MSG_back_del_char);
***************
*** 455,460 ****
--- 457,463 ----
  * are fatal.
  */
  void keyadd (new, funcp, name, modify)
+ int	new, modify;
  bool   (*funcp) ();
  char   *name;
  {
diff -cb orig/tcap.c new/tcap.c
*** orig/tcap.c	Fri Nov 22 19:03:26 1991
--- new/tcap.c	Mon Jan 06 15:41:22 1992
***************
*** 6,11 ****
--- 6,17 ----
  
  #ifdef UNIX
  
+ #ifdef OS2
+ #define INCL_NOPM
+ #define INCL_VIO
+ #include <os2.h>
+ #endif
+ 
  #define	MARGIN	8
  #define	SCRSIZ	64
  #define	NPAUSE	10			/* # times thru update to pause */
***************
*** 19,25 ****
  void	putpad();
  #endif
  
! #ifdef	COLOR
  extern int		tcapfcol();
  extern int		tcapbcol();
  #endif
--- 25,31 ----
  void	putpad();
  #endif
  
! #ifdef USECOLOR
  extern int		tcapfcol();
  extern int		tcapbcol();
  #endif
***************
*** 26,32 ****
  
  #define TCAPSLEN 315
  char tcapbuf[TCAPSLEN];
! char *UP, PC, *CM, *CE, *CL, *SO, *SE;
  
  #ifdef BSD
  #include <sys/ioctl.h>
--- 32,38 ----
  
  #define TCAPSLEN 315
  char tcapbuf[TCAPSLEN];
! char *UP, PC, *CM, *CE, *CL, *SO, *SE, *TI, *TE;
  
  #ifdef BSD
  #include <sys/ioctl.h>
***************
*** 55,63 ****
--- 61,73 ----
  
  	if ((tv_stype = getenv("TERM")) == NULL)
  	{
+ #ifndef OS2
  		puts("Environment variable TERM not defined!\r");
  		ttclose();
  		exit(1);
+ #else
+                 tv_stype = "ansi";
+ #endif
  	}
  
  	if ((tgetent(tcbuf, tv_stype)) != 1)
***************
*** 83,88 ****
--- 93,99 ----
  		else
  #endif /* ULTRIX */
  #endif /* BSD */
+ #ifndef OS2
  			if ((nrow=(short)tgetnum("li")-1) == -1){
  				puts("termcap entry incomplete (lines)\r");
  				ttclose();	/* fix in 1.13 */
***************
*** 90,96 ****
  			}
  	printf ("nrow %d, ncol %d\n", nrow, ncol);
  	/* don't allow to specify a larger number of rows than we can handle 1.13 */
! 	if (nrow > NROW)
  		nrow = NROW;
  
  	if ((ncol=(short)tgetnum("co")) == -1){
--- 101,107 ----
  			}
  	printf ("nrow %d, ncol %d\n", nrow, ncol);
  	/* don't allow to specify a larger number of rows than we can handle 1.13 */
! 	if (nrow > NMAXROW)
  		nrow = NROW;
  
  	if ((ncol=(short)tgetnum("co")) == -1){
***************
*** 99,112 ****
  		exit(1);
  	}
  	/* don't allow to specify a larger number of cols than we can handle 1.13 */
! 	if (ncol > NCOL)
  		ncol = NCOL;
  
  	p = tcapbuf;
  	t = tgetstr("pc", &p);
  	if(t)
  		PC = *t;
  
  	CL = tgetstr("cl", &p);
  	CM = tgetstr("cm", &p);
  	CE = tgetstr("ce", &p);
--- 110,135 ----
  		exit(1);
  	}
  	/* don't allow to specify a larger number of cols than we can handle 1.13 */
! 	if (ncol > NMAXCOL)
  		ncol = NCOL;
+ #else
+         {
+            VIOMODEINFO viomi;
  
+            viomi.cb = sizeof(viomi);
+            VioGetMode(&viomi, 0);
+            nrow = viomi.row;
+            ncol = viomi.col;
+         }
+ #endif
+ 
  	p = tcapbuf;
  	t = tgetstr("pc", &p);
  	if(t)
  		PC = *t;
  
+     TI = tgetstr("ti", &p);
+     TE = tgetstr("te", &p);
  	CL = tgetstr("cl", &p);
  	CM = tgetstr("cm", &p);
  	CE = tgetstr("ce", &p);
***************
*** 145,150 ****
--- 168,179 ----
  	putpad(CL);
  }
  
+ void	tcapinit(init)
+ int init;
+ {
+         putpad(init ? TI : TE);
+ }
+ 
  void	tcaprev(state)		/* change reverse video status */
  int state;		/* FALSE = normal video, TRUE = reverse video */
  
***************
*** 159,164 ****
--- 188,194 ----
  
  void	putnpad(str, n)
  char    *str;
+ int n;
  {
  	tputs(str, n, ttputc);
  }
diff -cb orig/termio.c new/termio.c
*** orig/termio.c	Fri Nov 22 19:03:24 1991
--- new/termio.c	Mon Jan 06 15:51:50 1992
***************
*** 13,19 ****
--- 13,32 ----
  #ifdef BSD
  #include    <sys/ioctl.h>
  #else
+ #ifdef OS2
+ #define INCL_NOPM
+ #define INCL_DOS
+ #define INCL_KBD
+ #include    <os2.h>
+ #include    <io.h>
+ #else
+ #ifdef MINIX
+ #include    <sgtty.h>
+ #define O_NDELAY O_NONBLOCK
+ #else
  #include    <termio.h>
+ #endif /* MINIX */
+ #endif /* OS2 */
  #endif /* BSD */
  #include    <errno.h>
  #include    <fcntl.h>
***************
*** 27,36 ****
--- 40,62 ----
  struct	sgttyb	otermb;
  struct	sgttyb	ntermb;
  #else
+ #ifdef OS2
+ KBDINFO kbst, kbst_std;
+ #else
+ #ifdef MINIX
+ struct  sgttyb  otermio;    /* original terminal characteristics */
+ struct  sgttyb  ntermio;    /* charactoristics to use inside */
+ struct  tchars  tchars, tcharsorig;
+ #else
  struct  termio  otermio;    /* original terminal characteristics */
  struct  termio  ntermio;    /* charactoristics to use inside */
+ #endif /* MINIX */
+ #endif /* OS2 */
  #endif /* BSD */
+ 
+ #ifndef OS2
  extern	errno; /* System error number -- Necessary when compiling in BSD 1.13 */
+ #endif
  
  int     nrow;                   /* Terminal size, rows.         */
  int     ncol;                   /* Terminal size, columns.      */
***************
*** 75,80 ****
--- 101,121 ----
  			ncol = NCOL;
  		}
  #else
+ #ifdef OS2
+         setmode(1, O_BINARY);
+ #else
+ #ifdef MINIX
+ 	ioctl(0, TIOCGETP, &otermio);
+     	ntermio = otermio;
+     	ntermio.sg_flags &= ~ECHO;
+     	ntermio.sg_flags |= RAW;
+     	ioctl(0, TIOCSETP, &ntermio);
+     	ioctl(0, TIOCGETC, &tcharsorig);
+     	tchars = tcharsorig;
+     	tchars.t_intrc = tchars.t_quitc = tchars.t_startc =
+ 	tchars.t_stopc = tchars.t_eofc = tchars.t_brkc = -1;
+     	ioctl(0, TIOCSETC, &tchars);
+ #else
  		ioctl(0, TCGETA, &otermio); /* save old settings */
  		ntermio.c_iflag = 0;        /* setup new settings */
  		ntermio.c_oflag = 0;
***************
*** 84,91 ****
--- 125,134 ----
  		ntermio.c_cc[VMIN] = 1;
  		ntermio.c_cc[VTIME] = 0;
  		ioctl(0, TCSETAW, &ntermio); /* and activate them */
+ #endif /* MINIX */
  		kbdflgs = fcntl( 0, F_GETFL, 0 );
  		kbdpoll = FALSE;
+ #endif /* OS2 */
  		/* on all screens we are not sure of the initial position
         of the cursor                    */
  		ttrow = 999;
***************
*** 92,99 ****
  		ttcol = 999;
  		nrow = NROW;
  		ncol = NCOL;
! #endif
! 	}
  
  	/*
   * This function gets called just before we go back home to the command
--- 135,142 ----
  		ttcol = 999;
  		nrow = NROW;
  		ncol = NCOL;
! #endif /* BSD */
! }
  
  	/*
   * This function gets called just before we go back home to the command
***************
*** 100,118 ****
   * interpreter. On VMS it puts the terminal back in a reasonable state.
   * Another no-operation on CPM.
   */
! 	void  ttclose()
! 	    {
  #ifdef BSD
  		if (ioctl(0, TIOCSETP, &otermb) == -1) /* restore terminal settings */
  			printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
  #else
  		if (ioctl(0, TCSETAW, &otermio) == -1) /* restore terminal settings */
  			printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
  		if (fcntl(0, F_SETFL, kbdflgs) == -1)
  			printf ("closing fcntl on dev 0 failure, error = %d\n", errno);
! #endif
  
! 	}
  
  	/*
   * Write a character to the display. On VMS, terminal output is buffered, and
--- 143,195 ----
   * interpreter. On VMS it puts the terminal back in a reasonable state.
   * Another no-operation on CPM.
   */
! void  ttclose()
! {
  #ifdef BSD
  		if (ioctl(0, TIOCSETP, &otermb) == -1) /* restore terminal settings */
  			printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
  #else
+ #ifdef OS2
+         setmode(1, O_TEXT);
+ #else
+ #ifdef MINIX
+         if (ioctl(0, TIOCSETP, &otermio) == -1 ||
+             ioctl(0, TIOCSETC, &tcharsorig) == -1 )
+ 		printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
+ #else
  		if (ioctl(0, TCSETAW, &otermio) == -1) /* restore terminal settings */
  			printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
+ #endif /* MINIX */
  		if (fcntl(0, F_SETFL, kbdflgs) == -1)
  			printf ("closing fcntl on dev 0 failure, error = %d\n", errno);
! #endif /* OS2 */
! #endif /* BSD */
! }
  
! #ifdef OS2
! void ttraw(void)
! {
!     PFNSIGHANDLER oldhandler;
!     USHORT oldact;
! 
!     DosSetSigHandler((PFNSIGHANDLER) NULL, &oldhandler, &oldact,
!                      SIGA_IGNORE, SIG_CTRLBREAK);
!     DosSetSigHandler((PFNSIGHANDLER) NULL, &oldhandler, &oldact,
!                      SIGA_IGNORE, SIG_CTRLC);
! 
!     kbst_std.cb = sizeof(kbst_std);
!     KbdGetStatus(&kbst_std, 0);
!     kbst = kbst_std;
!     kbst.fsMask &= ~(KEYBOARD_ECHO_ON  | KEYBOARD_ASCII_MODE | KEYBOARD_SHIFT_REPORT);
!     kbst.fsMask |=  (KEYBOARD_ECHO_OFF | KEYBOARD_BINARY_MODE);
!     KbdSetStatus(&kbst, 0);
! }
! 
! void ttcooked(void)
! {
!     KbdSetStatus(&kbst_std, 0);
! }
! #endif
    
  	/*
   * Write a character to the display. On VMS, terminal output is buffered, and
***************
*** 120,138 ****
   * On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
   * MS-DOS (use the very very raw console output routine).
   */
! 	void ttputc(c)
  	    {
! 		fputc(c, stdout);
  	}
  
  	/*
   * Flush terminal buffer. Does real work where the terminal output is buffered
   * up. A no-operation on systems where byte at a time terminal I/O is done.
   */
! 	void ttflush()
  	    {
! 		fflush(stdout);
  	}
  
  	/*
   * Read a character from the terminal, performing no editing and doing no echo
--- 197,240 ----
   * On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
   * MS-DOS (use the very very raw console output routine).
   */
! 
! #ifdef OS2
! static int size = 0;
! static char buffer[2048];
! #endif
! 
! void ttputc(c)
! int c;
! {
! #ifdef OS2
!         if ( size == sizeof(buffer) )
          {
!           write(1, buffer, size);
!           size = 0;
          }
  
+         buffer[size++] = c;
+ #else
+ 	fputc(c, stdout);
+ #endif
+ }
+ 
  	/*
   * Flush terminal buffer. Does real work where the terminal output is buffered
   * up. A no-operation on systems where byte at a time terminal I/O is done.
   */
! void ttflush()
! {
! #ifdef OS2
!         if ( size )
          {
!           write(1, buffer, size);
!           size = 0;
          }
+ #else
+ 	fflush(stdout);
+ #endif
+ }
  
  	/*
   * Read a character from the terminal, performing no editing and doing no echo
***************
*** 139,146 ****
   * at all. More complex in VMS that almost anyplace else, which figures. Very
   * simple on CPM, because the system can do exactly what you want.
   */
! 	ttgetc()
  	    {
  		if( kbdqp )
  			kbdqp = FALSE;
  		else
--- 241,272 ----
   * at all. More complex in VMS that almost anyplace else, which figures. Very
   * simple on CPM, because the system can do exactly what you want.
   */
! ttgetc()
! {
! #ifdef OS2
!         static int ext, scan;
!         KBDKEYINFO ki;
! 
!         if ( ext )
!         {
!         	ext = 0;
!         	return scan;
!         }
!         else
          {
+           	ttflush();
+           	KbdCharIn(&ki, IO_WAIT, 0);
+ 
+           	if ( ki.chChar == 0 || ki.chChar == 0xE0 )
+ 	        {
+         		ext = 1;
+             		scan = ki.chScan;
+             		return 0xE0;
+           	}
+           	else
+             		return ki.chChar;
+         }
+ #else
  	if( kbdqp )
  		kbdqp = FALSE;
  	else
***************
*** 157,172 ****
  			kbdpoll = FALSE;
  			while (read(0, &kbdq, 1) != 1)
  				;
! #endif
  		}
  		return ( kbdq & 127 );
! 	}
  
! 	/* typahead():    Check to see if any characters are already in the
          keyboard buffer
  */
! 	ttkeyready ()
! 	    {
  		if( !kbdqp )
  		{
  #ifdef BSD
--- 283,305 ----
  		kbdpoll = FALSE;
  		while (read(0, &kbdq, 1) != 1)
  			;
! #endif /* BSD */
  	}
  	return ( kbdq & 127 );
! #endif /* OS2 */
! }
  
! /* typahead():    Check to see if any characters are already in the
     keyboard buffer
  */
! ttkeyready ()
! {
! #ifdef OS2
!         KBDKEYINFO ki;
! 
!         KbdPeek(&ki, 0);
!         return (ki.fbStatus != 0);
! #else
  	if( !kbdqp )
  	{
  #ifdef BSD
***************
*** 177,189 ****
  			kbdpoll = TRUE;    /*  fix in 1.13 */
  			kbdqp = TRUE;
  #else
  			if( !kbdpoll && fcntl( 0, F_SETFL, kbdflgs | O_NDELAY ) < 0 )
  				return(FALSE);
  			kbdpoll = TRUE;    /*  fix in 1.13 */
  			kbdqp = (1 == read( 0, &kbdq, 1 ));
! #endif
  
  		}
  		return ( kbdqp );
! 	}
  #endif
--- 310,328 ----
  		kbdpoll = TRUE;    /*  fix in 1.13 */
  		kbdqp = TRUE;
  #else
+ #ifdef X_MINIX
+ 	/* MINIX has non-blocking mode but it doesn't work !?!? */
+ 		return FALSE;
+ #else
  		if( !kbdpoll && fcntl( 0, F_SETFL, kbdflgs | O_NDELAY ) < 0 )
  			return(FALSE);
  		kbdpoll = TRUE;    /*  fix in 1.13 */
  		kbdqp = (1 == read( 0, &kbdq, 1 ));
! #endif /* MINIX */
! #endif /* BSD */
  
  	}
  	return ( kbdqp );
! #endif /* OS2 */
! }
  #endif
diff -cb orig/text.c new/text.c
*** orig/text.c	Fri Nov 22 19:03:16 1991
--- new/text.c	Mon Jan 06 15:30:10 1992
***************
*** 8,16 ****
  char    MSG_no_mark[]   = "No mark in this window";
  char    MSG_go_b_n[]    = "Goto byte number: ";
  char    MSG_bad_num[]   = "ERROR: Bad number";
! char    MSG_lX[]        = "%lX";
! char    MSG_lO[]        = "%lO";
! char    MSG_lD[]        = "%lD";
  
  /* in buffer.c */
  char    MSG_use_b[]     = "Enter name of buffer to goto: ";
--- 8,16 ----
  char    MSG_no_mark[]   = "No mark in this window";
  char    MSG_go_b_n[]    = "Goto byte number: ";
  char    MSG_bad_num[]   = "ERROR: Bad number";
! char    MSG_lX[]        = "%lx";
! char    MSG_lO[]        = "%lo";
! char    MSG_lD[]        = "%ld";
  
  /* in buffer.c */
  char    MSG_use_b[]     = "Enter name of buffer to goto: ";
***************
*** 50,55 ****
--- 50,58 ----
  char    MSG_04X[]       = "%04X";
  char    MSG_08lX[]      = "%08lX";
  char    MSG_prog_name[] = "BEAV";
+ char    MSG_init_file[] = "beav.ini";
+ char    MSG_init_var[]  = "INIT";
+ char    MSG_init_path[] = "PATH";
  char    MSG_disp_b_lst[]= " Buffer List ";
  char    MSG_file[]      = "File: ";
  char    MSG_RO[]        = " [RO]";
***************
*** 215,221 ****
--- 218,228 ----
  
  /* in spawn.c */
  char    MSG_shell[]     = "COMSPEC";
+ #ifndef OS2
  char    MSG_def_shell[] = "/command.com";
+ #else
+ char    MSG_def_shell[] = "c:/os2/cmd.exe";
+ #endif
  char    MSG_pmpt[]      = "PROMPT=[BEAV]";
  char    MSG_pt[]        = "PROMPT";
  char    MSG_pme[]       = "PROMPT=";
diff -cb orig/tty.c new/tty.c
*** orig/tty.c	Fri Nov 22 19:03:26 1991
--- new/tty.c	Mon Jan 06 15:30:12 1992
***************
*** 13,20 ****
  void    asciiparm ();
  void    ttnowindow ();    /* stub */
  void    ttcolor ();
! extern void tcapopen ();
! extern void tcapmove ();
  
  #ifdef MSDOS
  #include    "dos.h"
--- 13,20 ----
  void    asciiparm ();
  void    ttnowindow ();    /* stub */
  void    ttcolor ();
! int	tcapopen ();
! int	tcapmove ();
  
  #ifdef MSDOS
  #include    "dos.h"
***************
*** 41,48 ****
--- 41,54 ----
  #ifdef MSDOS
  	ttraw ();
  #endif
+ #ifdef OS2
+     ttraw ();
+ #endif
  #ifdef UNIX
  	tcapopen();
+     tcapinit(1);
+     tcapmove(0, 0);
+     tcapeeop();
  #endif
  }
  
***************
*** 55,60 ****
--- 61,74 ----
  #ifdef MSDOS
  	ttcooked ();
  #endif
+ #ifdef OS2
+     ttcooked ();
+ #endif
+ #ifdef UNIX
+     tcapinit(0);
+     tcapmove(0, 0);
+     tcapeeop();
+ #endif
  }
  
  /*
***************
*** 65,70 ****
--- 79,85 ----
  * location last time!
  */
  void    ttmove (row, col)
+ int row, col;
  {
  #ifdef MSDOS
  	union   REGS    regs;
diff -cb orig/ttykbd.c new/ttykbd.c
*** orig/ttykbd.c	Fri Nov 22 19:03:24 1991
--- new/ttykbd.c	Mon Jan 06 15:56:08 1992
***************
*** 111,118 ****
  #endif
  /*
   * The keyboard's special characters, those things that are prefixed with
!  * a 0x1F, are placed into the keyboard tables as KCTRL || 0x80 || x, for some
!  * x, i.e. they have both the control and 0x80 bits set, so they won't conflict
   * with anything else on the keyboard.
   */
  
--- 111,118 ----
  #endif
  /*
   * The keyboard's special characters, those things that are prefixed with
!  * a 0x1F, are placed into the keyboard tables as KCTRL || 0x800 || x, for some
!  * x, i.e. they have both the control and 0x800 bits set, so they won't conflict
   * with anything else on the keyboard.
   */
  
***************
*** 193,247 ****
  	/*  KCTRL | 0xF3, NULL, "Sh-Print", */
  	0, NULL, NULL
  };
  
  KEY_NAME_ARRAY  ibm_keys[] =
  {
! 	KCTLX | 0x80 | 0x3B, MSG_display_bindings, "F1",
! 	    KCTLX | 0x80 | 0x3C, MSG_set_mark, "F2",
! 	    KCTLX | 0x80 | 0x3D, MSG_forw_search, "F3",
! 	    KCTLX | 0x80 | 0x3E, MSG_search_again, "F4",
! 	    KCTLX | 0x80 | 0x3F, MSG_query_replace, "F5",
! 	    KCTLX | 0x80 | 0x40, MSG_yank, "F6",
! 	    KCTLX | 0x80 | 0x41, MSG_copy_region, "F7",
! 	    KCTLX | 0x80 | 0x42, MSG_kill_region, "F8",
! 	    KCTLX | 0x80 | 0x43, MSG_goto_line, "F9",
! 	    KCTLX | 0x80 | 0x44, MSG_abort, "F10",
! 	    KCTLX | 0x80 | 0x54, MSG_help, "Sh-F1",
! 	    KCTLX | 0x80 | 0x55, MSG_file_read, "Sh-F2",
! 	    KCTLX | 0x80 | 0x56, MSG_file_save, "Sh-F3",
! 	    KCTLX | 0x80 | 0x57, MSG_file_visit, "Sh-F4",
! 	    KCTLX | 0x80 | 0x58, MSG_file_write, "Sh-F5",
! 	    KCTLX | 0x80 | 0x59, MSG_flush_all, "Sh-F6",
! 	    KCTLX | 0x80 | 0x5A, MSG_set_file_name, "Sh-F7",
! 	    KCTLX | 0x80 | 0x5B, MSG_file_insert, "Sh-F8",
! 	    KCTLX | 0x80 | 0x5C, MSG_exit_flush_all, "Sh-F9",
! 	    KCTLX | 0x80 | 0x5D, MSG_quit, "Sh-F10",
! 	    KCTLX | 0x80 | 0x5E, MSG_display_buffers, "Ctl-F1",
! 	    KCTLX | 0x80 | 0x5F, MSG_use_buffer, "Ctl-F2",
! 	    KCTLX | 0x80 | 0x60, MSG_kill_buffer, "Ctl-F3",
! 	    KCTLX | 0x80 | 0x61, MSG_next_buff, "Ctl-F4",
! 	    KCTLX | 0x80 | 0x62, MSG_prev_buff, "Ctl-F5",
! 	    KCTLX | 0x80 | 0x63, MSG_yank_buffer, "Ctl-F6",
! 	    KCTLX | 0x80 | 0x64, MSG_set_file_name, "Ctl-F7",
! 	    KCTLX | 0x80 | 0x65, MSG_file_insert, "Ctl-F8",
! 	    KCTLX | 0x80 | 0x66, MSG_exit_flush_all, "Ctl-F9",
! 	    KCTLX | 0x80 | 0x67, MSG_quit, "Ctl-F10",
! 	    KCTLX | 0x80 | 0x48, MSG_back_line, "North",
! 	    KCTLX | 0x80 | 0x4D, MSG_forw_char, "East",
! 	    KCTLX | 0x80 | 0x74, MSG_forw_unit, "Ctl-East",
! 	    KCTLX | 0x80 | 0x50, MSG_forw_line, "South",
! 	    KCTLX | 0x80 | 0x4B, MSG_back_char, "West",
! 	    KCTLX | 0x80 | 0x73, MSG_back_unit, "Ctl-West",
! 	    KCTLX | 0x80 | 0x49, MSG_back_page, "PageDown",
! 	    KCTLX | 0x80 | 0x47, MSG_goto_bob, "Home",
! 	    KCTLX | 0x80 | 0x51, MSG_forw_page, "PageUp",
! 	    KCTLX | 0x80 | 0x4F, MSG_goto_eob, "End",
! 	    KCTLX | 0x80 | 0x52, MSG_ins_toggle, "Insert",
! 	    KCTLX | 0x80 | 0x53, MSG_forw_del_char, "Delete",
! 	    KCTLX | 0x80 | 0x76, MSG_forw_window, "Ctl-PageDown",
! 	    KCTLX | 0x80 | 0x84, MSG_back_window, "Ctl-PageUp",
! 	    KCTLX | 0x80 | 0x72, MSG_print, "Ctl-Print",
! 	    KCTLX | 0x80 | 0x0F, MSG_forw_unit, "Sh-Tab",
  	    0, NULL, NULL
  };
  #endif
--- 193,335 ----
  	/*  KCTRL | 0xF3, NULL, "Sh-Print", */
  	0, NULL, NULL
  };
+ #endif
  
+ #if defined(MSDOS) || defined(OS2)
  KEY_NAME_ARRAY  ibm_keys[] =
  {
!             KCTLX | 0x800 | 0x3B, MSG_display_bindings, "F1",
!             KCTLX | 0x800 | 0x3C, MSG_set_mark,         "F2",
!             KCTLX | 0x800 | 0x3D, MSG_forw_search,      "F3",
!             KCTLX | 0x800 | 0x3E, MSG_search_again,     "F4",
!             KCTLX | 0x800 | 0x3F, MSG_query_replace,    "F5",
!             KCTLX | 0x800 | 0x40, MSG_yank,             "F6",
!             KCTLX | 0x800 | 0x41, MSG_copy_region,      "F7",
!             KCTLX | 0x800 | 0x42, MSG_kill_region,      "F8",
!             KCTLX | 0x800 | 0x43, MSG_goto_line,        "F9",
!             KCTLX | 0x800 | 0x44, NULL,                 "F10",
!             KCTLX | 0x800 | 0x85, NULL,                 "F11",
!             KCTLX | 0x800 | 0x86, NULL,                 "F12",
!             KCTLX | 0x800 | 0x54, MSG_help,             "Sh-F1",
!             KCTLX | 0x800 | 0x55, MSG_file_read,        "Sh-F2",
!             KCTLX | 0x800 | 0x56, MSG_file_save,        "Sh-F3",
!             KCTLX | 0x800 | 0x57, MSG_file_visit,       "Sh-F4",
!             KCTLX | 0x800 | 0x58, MSG_file_write,       "Sh-F5",
!             KCTLX | 0x800 | 0x59, MSG_flush_all,        "Sh-F6",
!             KCTLX | 0x800 | 0x5A, MSG_set_file_name,    "Sh-F7",
!             KCTLX | 0x800 | 0x5B, MSG_file_insert,      "Sh-F8",
!             KCTLX | 0x800 | 0x5C, MSG_exit_flush_all,   "Sh-F9",
!             KCTLX | 0x800 | 0x5D, MSG_quit,             "Sh-F10",
!             KCTLX | 0x800 | 0x87, NULL,                 "Sh-F11",
!             KCTLX | 0x800 | 0x88, NULL,                 "Sh-F12",
!             KCTLX | 0x800 | 0x5E, MSG_display_buffers,  "Ctl-F1",
!             KCTLX | 0x800 | 0x5F, MSG_use_buffer,       "Ctl-F2",
!             KCTLX | 0x800 | 0x60, MSG_kill_buffer,      "Ctl-F3",
!             KCTLX | 0x800 | 0x61, MSG_next_buff,        "Ctl-F4",
!             KCTLX | 0x800 | 0x62, MSG_prev_buff,        "Ctl-F5",
!             KCTLX | 0x800 | 0x63, MSG_yank_buffer,      "Ctl-F6",
!             KCTLX | 0x800 | 0x64, MSG_set_file_name,    "Ctl-F7",
!             KCTLX | 0x800 | 0x65, MSG_file_insert,      "Ctl-F8",
!             KCTLX | 0x800 | 0x66, MSG_exit_flush_all,   "Ctl-F9",
!             KCTLX | 0x800 | 0x67, MSG_quit,             "Ctl-F10",
!             KCTLX | 0x800 | 0x89, NULL,                 "Ctl-F11",
!             KCTLX | 0x800 | 0x8A, NULL,                 "Ctl-F12",
!             KCTLX | 0x800 | 0x68, NULL,                 "Alt-F1",
!             KCTLX | 0x800 | 0x69, NULL,                 "Alt-F2",
!             KCTLX | 0x800 | 0x6A, NULL,                 "Alt-F3",
!             KCTLX | 0x800 | 0x6B, NULL,                 "Alt-F4",
!             KCTLX | 0x800 | 0x6C, NULL,                 "Alt-F5",
!             KCTLX | 0x800 | 0x6D, NULL,                 "Alt-F6",
!             KCTLX | 0x800 | 0x6E, NULL,                 "Alt-F7",
!             KCTLX | 0x800 | 0x6F, NULL,                 "Alt-F8",
!             KCTLX | 0x800 | 0x70, NULL,                 "Alt-F9",
!             KCTLX | 0x800 | 0x71, NULL,                 "Alt-F10",
!             KCTLX | 0x800 | 0x8B, NULL,                 "Alt-F11",
!             KCTLX | 0x800 | 0x8C, NULL,                 "Alt-F12",
!             KCTLX | 0x800 | 0x48, MSG_back_line,        "North",
!             KCTLX | 0x800 | 0x4D, MSG_forw_char,        "East",
!             KCTLX | 0x800 | 0x50, MSG_forw_line,        "South",
!             KCTLX | 0x800 | 0x4B, MSG_back_char,        "West",
!             KCTLX | 0x800 | 0x8D, MSG_back_line,        "Ctl-North",
!             KCTLX | 0x800 | 0x74, MSG_forw_unit,        "Ctl-East",
!             KCTLX | 0x800 | 0x91, MSG_forw_line,        "Ctl-South",
!             KCTLX | 0x800 | 0x73, MSG_back_unit,        "Ctl-West",
!             KCTLX | 0x800 | 0x98, NULL,                 "Alt-North",
!             KCTLX | 0x800 | 0x9D, NULL,                 "Alt-East",
!             KCTLX | 0x800 | 0xA0, NULL,                 "Alt-South",
!             KCTLX | 0x800 | 0x9B, NULL,                 "Alt-West",
!             KCTLX | 0x800 | 0x49, MSG_back_page,        "PageDown",
!             KCTLX | 0x800 | 0x51, MSG_forw_page,        "PageUp",
!             KCTLX | 0x800 | 0x47, MSG_goto_bob,         "Home",
!             KCTLX | 0x800 | 0x4F, MSG_goto_eob,         "End",
!             KCTLX | 0x800 | 0x4C, NULL,                 "Center",
!             KCTLX | 0x800 | 0x76, MSG_forw_window,      "Ctl-PageDown",
!             KCTLX | 0x800 | 0x84, MSG_back_window,      "Ctl-PageUp",
!             KCTLX | 0x800 | 0x77, MSG_goto_bob,         "Ctl-Home",
!             KCTLX | 0x800 | 0x75, MSG_goto_eob,         "Ctl-End",
!             KCTLX | 0x800 | 0x8F, NULL,                 "Ctl-Center",
!             KCTLX | 0x800 | 0xA1, NULL,                 "Alt-PageDown",
!             KCTLX | 0x800 | 0x99, NULL,                 "Alt-PageUp",
!             KCTLX | 0x800 | 0x97, NULL,                 "Alt-Home",
!             KCTLX | 0x800 | 0x9F, NULL,                 "Alt-End",
!             KCTLX | 0x800 | 0x52, MSG_ins_toggle,       "Insert",
!             KCTLX | 0x800 | 0x53, MSG_forw_del_char,    "Delete",
!             KCTLX | 0x800 | 0x92, NULL,                 "Ctl-Insert",
!             KCTLX | 0x800 | 0x93, NULL,                 "Ctl-Delete",
!             KCTLX | 0x800 | 0xA2, NULL,                 "Alt-Insert",
!             KCTLX | 0x800 | 0xA3, NULL,                 "Alt-Delete",
!             KCTLX | 0x800 | 0x72, MSG_print,            "Ctl-Print",
!             KCTLX | 0x800 | 0x0F, NULL,                 "Sh-Tab",
!             KCTLX | 0x800 | 0x94, NULL,                 "Ctl-Tab",
!             KCTLX | 0x800 | 0xA5, NULL,                 "Alt-Tab",
!             KCTLX | 0x800 | 0x95, NULL,                 "Ctrl-Num/",
!             KCTLX | 0x800 | 0x96, NULL,                 "Ctrl-Num*",
!             KCTLX | 0x800 | 0x8E, NULL,                 "Ctrl-Num-",
!             KCTLX | 0x800 | 0x90, NULL,                 "Ctrl-Num+",
!             KCTLX | 0x800 | 0xA4, NULL,                 "Alt-Num/",
!             KCTLX | 0x800 | 0x37, NULL,                 "Alt-Num*",
!             KCTLX | 0x800 | 0x4A, NULL,                 "Alt-Num-",
!             KCTLX | 0x800 | 0x4E, NULL,                 "Alt-Num+",
!             KCTLX | 0x800 | 0xA6, NULL,                 "Alt-NumEnter",
!             KCTLX | 0x800 | 0x01, NULL,                 "Alt-Esc",
!             KCTLX | 0x800 | 0x1C, NULL,                 "Alt-Enter",
!             KCTLX | 0x800 | 0x0E, NULL,                 "Alt-Backspace",
!             KCTLX | 0x800 | 0x1E, NULL,                 "Alt-A",
!             KCTLX | 0x800 | 0x30, NULL,                 "Alt-B",
!             KCTLX | 0x800 | 0x2E, NULL,                 "Alt-C",
!             KCTLX | 0x800 | 0x20, NULL,                 "Alt-D",
!             KCTLX | 0x800 | 0x12, NULL,                 "Alt-E",
!             KCTLX | 0x800 | 0x21, NULL,                 "Alt-F",
!             KCTLX | 0x800 | 0x22, NULL,                 "Alt-G",
!             KCTLX | 0x800 | 0x23, NULL,                 "Alt-H",
!             KCTLX | 0x800 | 0x17, NULL,                 "Alt-I",
!             KCTLX | 0x800 | 0x24, NULL,                 "Alt-J",
!             KCTLX | 0x800 | 0x25, NULL,                 "Alt-K",
!             KCTLX | 0x800 | 0x26, NULL,                 "Alt-L",
!             KCTLX | 0x800 | 0x32, NULL,                 "Alt-M",
!             KCTLX | 0x800 | 0x31, NULL,                 "Alt-N",
!             KCTLX | 0x800 | 0x18, NULL,                 "Alt-O",
!             KCTLX | 0x800 | 0x19, NULL,                 "Alt-P",
!             KCTLX | 0x800 | 0x10, NULL,                 "Alt-Q",
!             KCTLX | 0x800 | 0x13, NULL,                 "Alt-R",
!             KCTLX | 0x800 | 0x1F, NULL,                 "Alt-S",
!             KCTLX | 0x800 | 0x14, NULL,                 "Alt-T",
!             KCTLX | 0x800 | 0x16, NULL,                 "Alt-U",
!             KCTLX | 0x800 | 0x2F, NULL,                 "Alt-V",
!             KCTLX | 0x800 | 0x11, NULL,                 "Alt-W",
!             KCTLX | 0x800 | 0x2D, NULL,                 "Alt-X",
!             KCTLX | 0x800 | 0x15, NULL,                 "Alt-Y",
!             KCTLX | 0x800 | 0x2C, NULL,                 "Alt-Z",
!             KCTLX | 0x800 | 0x78, NULL,                 "Alt-1",
!             KCTLX | 0x800 | 0x79, NULL,                 "Alt-2",
!             KCTLX | 0x800 | 0x7A, NULL,                 "Alt-3",
!             KCTLX | 0x800 | 0x7B, NULL,                 "Alt-4",
!             KCTLX | 0x800 | 0x7C, NULL,                 "Alt-5",
!             KCTLX | 0x800 | 0x7D, NULL,                 "Alt-6",
!             KCTLX | 0x800 | 0x7E, NULL,                 "Alt-7",
!             KCTLX | 0x800 | 0x7F, NULL,                 "Alt-8",
!             KCTLX | 0x800 | 0x80, NULL,                 "Alt-9",
!             KCTLX | 0x800 | 0x81, NULL,                 "Alt-0",
  	    0, NULL, NULL
  };
  #endif
***************
*** 254,259 ****
--- 342,348 ----
   */
  static int  unkey = KRANDOM;    /* jam - for ungetkey */
  void ungetkey (k)
+ int k;
  {
  	unkey = k;
  }
***************
*** 276,285 ****
  			return (METACH);
  		return (c | KCTRL);
  	}
! 	if (c == 0)
  	{
  		c = ttgetc ();
! 		return (c | 0x80 | KCTLX);
  	}
  	return (c);
  }
--- 365,374 ----
  			return (METACH);
  		return (c | KCTRL);
  	}
!     if (c == 0 || c == 0xE0)
  	{
  		c = ttgetc ();
!         return (c | 0x800 | KCTLX);
  	}
  	return (c);
  }
***************
*** 294,300 ****
   */
  void ttykeymapinit ()
  {
! #if MSDOS
  	KEY_NAME_ARRAY  *ptr;
  	int     i;
  	char    buf[NCOL];
--- 383,389 ----
   */
  void ttykeymapinit ()
  {
! #ifdef MSDOS
  	KEY_NAME_ARRAY  *ptr;
  	int     i;
  	char    buf[NCOL];
***************
*** 318,323 ****
--- 407,428 ----
  	sprintf (buf, MSG_sp_key, i);
  	writ_echo (buf);
  #endif
+ #ifdef OS2
+ 	KEY_NAME_ARRAY  *ptr;
+ 	int     i;
+ 	char    buf[NCOL];
+         ptr = ibm_keys;
+         i = 0;
+         while (ptr -> key_code != 0)
+         {
+             if (ptr -> func_name_str != NULL)
+                 keydup (ptr -> key_code, ptr -> func_name_str);
+             ptr++;
+             i++;
+         }
+      /* sprintf (buf, MSG_sp_key, i);
+         writ_echo (buf); */
+ #endif
  }
  /*
  *   Search key name array for given key code.
***************
*** 326,332 ****
  char    *keystrings (key)
  int     key;
  {
! #if MSDOS
  	KEY_NAME_ARRAY  *ptr;
  
  	if (wang_pc)
--- 431,437 ----
  char    *keystrings (key)
  int     key;
  {
! #ifdef MSDOS
  	KEY_NAME_ARRAY  *ptr;
  
  	if (wang_pc)
***************
*** 337,342 ****
--- 442,459 ----
  
  	if (!wang_pc && !ibm_pc)
  		return(NULL);
+ 
+     while (ptr -> key_code != 0)
+         {
+         if (key == ptr -> key_code)
+             {
+             return (ptr -> key_name_str);
+             }
+         ptr++;
+         }
+ #endif
+ #ifdef OS2
+     KEY_NAME_ARRAY  *ptr = ibm_keys;
  
  	while (ptr -> key_code != 0)
  	{
diff -cb orig/window.c new/window.c
*** orig/window.c	Fri Nov 22 19:03:24 1991
--- new/window.c	Mon Jan 06 15:30:14 1992
***************
*** 81,87 ****
  * to "move up".
  */
  bool    mvdnwind (f, n, k)
! register int    n;
  {
  	return (mvupwind (f, -n, KRANDOM));
  }
--- 81,87 ----
  * to "move up".
  */
  bool    mvdnwind (f, n, k)
! register int    f, n, k;
  {
  	return (mvupwind (f, -n, KRANDOM));
  }
***************
*** 96,102 ****
  * not really move "."; it moves the frame).
  */
  bool    mvupwind (f, n, k)
! int    n;
  {
  	A32   l_val, l_bytes;
  
--- 96,102 ----
  * not really move "."; it moves the frame).
  */
  bool    mvupwind (f, n, k)
! int     f, n, k;
  {
  	A32   l_val, l_bytes;
  
***************
*** 331,336 ****
--- 331,337 ----
  * because dot would move.
  */
  bool enlargewind (f, n, k)
+ int f, n, k;
  {
  	register    WINDOW * adjwp;
  	register    LINE * lp;
***************
*** 392,397 ****
--- 393,399 ----
  * do all the hard work.
  */
  bool shrinkwind (f, n, k)
+ int f, n, k;
  {
  	register    WINDOW * adjwp;
  	register    LINE * lp;
diff -cb orig/word.c new/word.c
*** orig/word.c	Fri Nov 22 19:03:26 1991
--- new/word.c	Mon Jan 06 15:30:16 1992
***************
*** 20,25 ****
--- 20,26 ----
  * the buffers.
  */
  char    backunit (f, n, k)
+ int f, n, k;
  {
  	char    ret;
  
***************
*** 44,49 ****
--- 45,51 ----
  * try and move beyond the buffer's end.
  */
  char    forwunit (f, n, k)
+ int f, n, k;
  {
  
  	if      (n < 0)
***************
*** 68,73 ****
--- 70,76 ----
  * way when it hits the end of the buffer.
  */
  bool delfunit (f, n, k)
+ int f, n, k;
  {
  	if (n < 0)
  		return (FALSE);
***************
*** 97,102 ****
--- 100,106 ----
  * to "M-Backspace".
  */
  bool delbunit (f, n, k)
+ int f, n, k;
  {
  	int size;
  

