home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / OS2 / BEAV132X.ZIP / PATCHES < prev    next >
Text File  |  1992-01-06  |  60KB  |  2,230 lines

  1. diff -cb orig/basic.c new/basic.c
  2. *** orig/basic.c    Fri Nov 22 19:03:22 1991
  3. --- new/basic.c    Mon Jan 06 15:28:10 1992
  4. ***************
  5. *** 35,41 ****
  6.   * the beginning of the buffer.
  7.   */
  8.   bool backchar (f, n, k)
  9. ! register int    n;
  10.   {
  11.       if (n < 0)
  12.           return (forwchar (f, -n, KRANDOM));
  13. --- 35,41 ----
  14.   * the beginning of the buffer.
  15.   */
  16.   bool backchar (f, n, k)
  17. ! register int  f, n, k;
  18.   {
  19.       if (n < 0)
  20.           return (forwchar (f, -n, KRANDOM));
  21. ***************
  22. *** 68,74 ****
  23.   * from the end of the buffer.
  24.   */
  25.   bool forwchar (f, n, k)
  26. ! register int    n;
  27.   {
  28.       if (n < 0)
  29.           return (backchar (f, -n, KRANDOM));
  30. --- 68,74 ----
  31.   * from the end of the buffer.
  32.   */
  33.   bool forwchar (f, n, k)
  34. ! register int f, n, k;
  35.   {
  36.       if (n < 0)
  37.           return (backchar (f, -n, KRANDOM));
  38. ***************
  39. *** 309,314 ****
  40. --- 309,315 ----
  41.   * the goal column is set.
  42.   */
  43.   bool forwline (f, n, k)
  44. + int f, n, k;
  45.   {
  46.       if (n < 0)
  47.           return (backline (f, -n, KRANDOM));
  48. ***************
  49. *** 338,343 ****
  50. --- 339,345 ----
  51.   * call "movedot" to perform the motion.
  52.   */
  53.   bool backline (f, n, k)
  54. + int f, n, k;
  55.   {
  56.       if (n < 0)
  57.           return (forwline (f, -n, KRANDOM));
  58. ***************
  59. *** 366,372 ****
  60.   *       to same position on new page.
  61.   */
  62.   bool forwpage (f, n, k)
  63. ! register int    n;
  64.   {
  65.       long    mov_lines;
  66.   
  67. --- 368,374 ----
  68.   *       to same position on new page.
  69.   */
  70.   bool forwpage (f, n, k)
  71. ! register int f, n, k;
  72.   {
  73.       long    mov_lines;
  74.   
  75. ***************
  76. *** 403,409 ****
  77.   * but it goes backwards.
  78.   */
  79.   bool backpage (f, n, k)
  80. ! register int    n;
  81.   {
  82.       long    mov_lines;
  83.   
  84. --- 405,411 ----
  85.   * but it goes backwards.
  86.   */
  87.   bool backpage (f, n, k)
  88. ! register int f, n, k;
  89.   {
  90.       long    mov_lines;
  91.   
  92. ***************
  93. *** 490,495 ****
  94. --- 492,498 ----
  95.   * to use.
  96.   */
  97.   bool gotoline (f, n, k)
  98. + int f, n, k;
  99.   {
  100.       A32      index;
  101.       register int    s;
  102. diff -cb orig/buffer.c new/buffer.c
  103. *** orig/buffer.c    Fri Nov 22 19:03:20 1991
  104. --- new/buffer.c    Mon Jan 06 15:28:12 1992
  105. ***************
  106. *** 503,508 ****
  107. --- 503,509 ----
  108.   */
  109.   BUFFER * bfind (bname, cflag)
  110.   register char  *bname;
  111. + int cflag;
  112.   {
  113.       register    BUFFER * bp;
  114.   
  115. diff -cb orig/def.h new/def.h
  116. *** orig/def.h    Fri Nov 22 19:03:18 1991
  117. --- new/def.h    Mon Jan 06 15:28:12 1992
  118. ***************
  119. *** 49,55 ****
  120.   #define     bool char       /* used for boolean values      */
  121.   #define     bits char       /* used for boolean bit flags   */
  122.   
  123. ! /* this define is reserved for the byte location in the a LINE structure */
  124.   #define     LPOS uint       /* this is a 32 bit address into the buffer */
  125.   
  126.   /*
  127. --- 49,55 ----
  128.   #define     bool char       /* used for boolean values      */
  129.   #define     bits char       /* used for boolean bit flags   */
  130.   
  131. ! /* this define is reserved for the byte location in a LINE structure */
  132.   #define     LPOS uint       /* this is a 32 bit address into the buffer */
  133.   
  134.   /*
  135. ***************
  136. *** 87,92 ****
  137. --- 87,94 ----
  138.   #define    ANSI    1            /* send ANSI escape codes */
  139.   #endif
  140.   
  141. + #define NMAXROW 128         /* Rows.for boot    */
  142. + #define NMAXCOL 132
  143.   #ifdef UNIX
  144.   #define NROW    100
  145.   #define NCOL    80          /* Columns.         */
  146. ***************
  147. *** 106,112 ****
  148.    * Table sizes, etc.
  149.    */
  150.   #define NSHASH  31          /* Symbol table hash size.      */
  151. ! #define NFILEN  80          /* Length, file name.           */
  152.   #define NBUFN   13          /* Length, buffer name.     */
  153.   #define NFILE   12          /* Length, file name.  */ /* krw */
  154.   #define NKBDM   256         /* Length, keyboard macro.      */
  155. --- 108,114 ----
  156.    * Table sizes, etc.
  157.    */
  158.   #define NSHASH  31          /* Symbol table hash size.      */
  159. ! #define NFILEN  256         /* Length, file name.           */
  160.   #define NBUFN   13          /* Length, buffer name.     */
  161.   #define NFILE   12          /* Length, file name.  */ /* krw */
  162.   #define NKBDM   256         /* Length, keyboard macro.      */
  163. ***************
  164. *** 199,205 ****
  165.    * between "getkey" and "getkbd" easier. The funny keys get
  166.    * mapped into the C1 control area.
  167.    */
  168. ! #define NKEYS   2048                    /* 11 bit code.                 */
  169.   
  170.   #define METACH  0x1B                    /* M- prefix,   Control-[, ESC  */
  171.   #define CTMECH  0x1C                    /* C-M- prefix, Control-\       */
  172. --- 201,207 ----
  173.    * between "getkey" and "getkbd" easier. The funny keys get
  174.    * mapped into the C1 control area.
  175.    */
  176. ! #define NKEYS   4096                    /* 12 bit code.                 */
  177.   
  178.   #define METACH  0x1B                    /* M- prefix,   Control-[, ESC  */
  179.   #define CTMECH  0x1C                    /* C-M- prefix, Control-\       */
  180. diff -cb orig/display.c new/display.c
  181. *** orig/display.c    Fri Nov 22 19:03:16 1991
  182. --- new/display.c    Mon Jan 06 15:53:34 1992
  183. ***************
  184. *** 99,105 ****
  185.       short   v_flag;             /* Flag word.                   */
  186.       short   v_color;            /* Color of the line.           */
  187.       XSHORT v_cost;      /* Cost of display.     */
  188. !     char    v_text[NCOL];       /* The actual characters.       */
  189.   }                   VIDEO;
  190.   
  191.   #define VFCHG   0x0001          /* Changed.                     */
  192. --- 99,105 ----
  193.       short   v_flag;             /* Flag word.                   */
  194.       short   v_color;            /* Color of the line.           */
  195.       XSHORT v_cost;      /* Cost of display.     */
  196. !     char    v_text[NMAXCOL];       /* The actual characters.       */
  197.   }                   VIDEO;
  198.   
  199.   #define VFCHG   0x0001          /* Changed.                     */
  200. ***************
  201. *** 130,138 ****
  202.   int     ttbot = HUGE;           /* Bottom of scroll region.     */
  203.   char    file_off_bad = FALSE;   /* Have file offsets been changed */
  204.   
  205. ! VIDEO * vscreen[NROW];          /* Edge vector, virtual.        */
  206. ! VIDEO * pscreen[NROW];          /* Edge vector, physical.       */
  207. ! VIDEO video[2 * (NROW)];        /* Actual screen data.          */
  208.   VIDEO blanks;                   /* Blank line image.            */
  209.   
  210.   /*
  211. --- 130,138 ----
  212.   int     ttbot = HUGE;           /* Bottom of scroll region.     */
  213.   char    file_off_bad = FALSE;   /* Have file offsets been changed */
  214.   
  215. ! VIDEO * vscreen[NMAXROW];       /* Edge vector, virtual.        */
  216. ! VIDEO * pscreen[NMAXROW];       /* Edge vector, physical.       */
  217. ! VIDEO video[2 * (NMAXROW)];     /* Actual screen data.          */
  218.   VIDEO blanks;                   /* Blank line image.            */
  219.   
  220.   /*
  221. ***************
  222. *** 154,160 ****
  223.       ttopen ();
  224.       ttinit ();
  225.       vp = &video[0];
  226. !     for (i = 0; i < NROW; ++i)
  227.       {
  228.           vscreen[i] = vp;
  229.           ++vp;
  230. --- 154,160 ----
  231.       ttopen ();
  232.       ttinit ();
  233.       vp = &video[0];
  234. !     for (i = 0; i < NMAXROW; ++i)
  235.       {
  236.           vscreen[i] = vp;
  237.           ++vp;
  238. ***************
  239. *** 162,168 ****
  240.           ++vp;
  241.       }
  242.       blanks.v_color = CTEXT;
  243. !     for (i = 0; i < NCOL; ++i)
  244.           blanks.v_text[i] = ' ';
  245.   }
  246.   
  247. --- 162,168 ----
  248.           ++vp;
  249.       }
  250.       blanks.v_color = CTEXT;
  251. !     for (i = 0; i < NMAXCOL; ++i)
  252.           blanks.v_text[i] = ' ';
  253.   }
  254.   
  255. ***************
  256. *** 192,197 ****
  257. --- 192,198 ----
  258.   * more efficient. No checking for errors.
  259.   */
  260.   void vtmove (row, col)
  261. + int row, col;
  262.   {
  263.       vtrow = row;
  264.       vtcol = col;
  265. ***************
  266. *** 221,227 ****
  267.           if (ISCTRL (c) != FALSE)
  268.           {
  269.               vtputc ('^');
  270. !             vtputc (c ^ 0x40);
  271.           }
  272.           else
  273.           {
  274. --- 222,228 ----
  275.           if (ISCTRL (c) != FALSE)
  276.           {
  277.               vtputc ('^');
  278. !             vtputc ((char) (c ^ 0x40));
  279.           }
  280.           else
  281.           {
  282. ***************
  283. *** 929,934 ****
  284. --- 930,936 ----
  285.   * reverse video works on most terminals.
  286.   */
  287.   void uline (row, vvp, pvp)
  288. + int row;
  289.   VIDEO * vvp;
  290.   VIDEO * pvp;
  291.   {
  292. diff -cb orig/echo.c new/echo.c
  293. *** orig/echo.c    Fri Nov 22 19:03:26 1991
  294. --- new/echo.c    Mon Jan 06 15:28:16 1992
  295. ***************
  296. *** 97,102 ****
  297. --- 97,103 ----
  298.   char    eread (fp, buf, nbuf, flag, ap)
  299.   char   *fp;
  300.   char   *buf;
  301. + int    nbuf, flag;
  302.   char   *ap;
  303.   {
  304.   
  305. ***************
  306. *** 194,199 ****
  307. --- 195,201 ----
  308.               quote_flag = 1;
  309.               break;
  310.           case (KCTRL | 'M'): /* Return, done.    */
  311. +                 case (KCTRL | 'J'): /* Linefeed, done.    */
  312.               buf[cpos] = '\0';
  313.               if (kbdmip != NULL)
  314.               {
  315. ***************
  316. *** 291,296 ****
  317. --- 293,299 ----
  318.   int     getxtra (sp1, sp2, cpos)
  319.   SYMBOL * sp1;
  320.   SYMBOL * sp2;
  321. + int cpos;
  322.   {
  323.   
  324.       register int    i;
  325. diff -cb orig/extend.c new/extend.c
  326. *** orig/extend.c    Fri Nov 22 19:03:22 1991
  327. --- new/extend.c    Mon Jan 06 15:29:44 1992
  328. ***************
  329. *** 94,99 ****
  330. --- 94,100 ----
  331.   * Print an error if there is anything wrong.
  332.   */
  333.   char    extend (f, n, k)
  334. + int f, n, k;
  335.   {
  336.   
  337.       register    SYMBOL * sp;
  338. ***************
  339. *** 200,205 ****
  340. --- 201,207 ----
  341.   * "ins-self" are only displayed if there is an argument.
  342.   */
  343.   char    wallchart (f, n, k)
  344. + int f, n, k;
  345.   {
  346.   
  347.       register char   s;
  348. diff -cb orig/file.c new/file.c
  349. *** orig/file.c    Fri Nov 22 19:03:16 1991
  350. --- new/file.c    Mon Jan 06 15:29:48 1992
  351. ***************
  352. *** 12,17 ****
  353. --- 12,18 ----
  354.   bool    writeout ();
  355.   bool    parse_f_name ();
  356.   A32    ffseek ();
  357. + A32     file_len();
  358.   
  359.   extern    char    MSG_rd_file[];
  360.   extern    char    MSG_trash[];
  361. ***************
  362. *** 125,130 ****
  363. --- 126,132 ----
  364.   * file-vist with auto window split, and readonly (view-file) (jam)
  365.   */
  366.   char    file_visit (f, n, k)
  367. + int f, n, k;
  368.   {
  369.       char    fname[NFILEN];
  370.       char    s;
  371. diff -cb orig/fileio.c new/fileio.c
  372. *** orig/fileio.c    Fri Nov 22 19:03:18 1991
  373. --- new/fileio.c    Mon Jan 06 15:59:34 1992
  374. ***************
  375. *** 11,17 ****
  376. --- 11,20 ----
  377.   #include    <sys/types.h>
  378.   #include    <fcntl.h>
  379.   #include    <sys/stat.h>
  380. + #ifndef O_BINARY
  381. + #define O_BINARY 0
  382.   #endif
  383. + #endif
  384.   #include        "def.h"
  385.   
  386.   extern    char    MSG_cnt_wr[];
  387. ***************
  388. *** 47,53 ****
  389.       return (FIOSUC);
  390.   #endif
  391.   #ifdef UNIX
  392. !     if ((ffp = open (fn, O_RDONLY)) == -1)/* pvr */
  393.           return (FIOERR);
  394.       ;
  395.       return (FIOSUC);
  396. --- 50,56 ----
  397.       return (FIOSUC);
  398.   #endif
  399.   #ifdef UNIX
  400. !         if ((ffp = open (fn, O_RDONLY | O_BINARY)) == -1)/* pvr */
  401.           return (FIOERR);
  402.       ;
  403.       return (FIOSUC);
  404. ***************
  405. *** 105,110 ****
  406. --- 108,120 ----
  407.       }
  408.       return (FIOSUC);
  409.   #endif
  410. + #ifdef OS2
  411. +         if ((ffp = open (fn, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
  412. +                          mode)) == -1)/* pvr */
  413. +         return (FIOERR);
  414. +     ;
  415. +     return (FIOSUC);
  416. + #else /* OS2 has UNIX set too */
  417.   #ifdef UNIX
  418.       /* set perms as in original file 1.31 */
  419.       if ((ffp = open (fn, O_WRONLY | O_CREAT, mode)) == -1)/* pvr */
  420. ***************
  421. *** 112,117 ****
  422. --- 122,128 ----
  423.       ;
  424.       return (FIOSUC);
  425.   #endif
  426. + #endif /* OS2 */
  427.   #ifdef AMIGA
  428.       /* set perms as in original file 1.31 */
  429.       if ((ffp = open (fn, O_WRONLY | O_CREAT, mode)) == -1)/* pvr */
  430. ***************
  431. *** 248,254 ****
  432.       source = fname;
  433.       backup = backname;
  434.       while ((*source > 0)
  435. ! #ifdef MSDOS
  436.           && (*source != '.'))
  437.   #else
  438.           )
  439. --- 259,265 ----
  440.       source = fname;
  441.       backup = backname;
  442.       while ((*source > 0)
  443. ! #if defined(MSDOS) || defined(OS2)
  444.           && (*source != '.'))
  445.   #else
  446.           )
  447. diff -cb orig/kbd.c new/kbd.c
  448. *** orig/kbd.c    Fri Nov 22 19:03:26 1991
  449. --- new/kbd.c    Mon Jan 06 15:29:50 1992
  450. ***************
  451. *** 115,121 ****
  452.           return;
  453.       }
  454.   #endif
  455. !     if (k & 0x80)
  456.       {
  457.           if ((np = keystrings (k)) != NULL)
  458.           {
  459. --- 115,121 ----
  460.           return;
  461.       }
  462.   #endif
  463. !     if (k & 0x800)
  464.       {
  465.           if ((np = keystrings (k)) != NULL)
  466.           {
  467. diff -cb orig/line.c new/line.c
  468. *** orig/line.c    Fri Nov 22 19:03:20 1991
  469. --- new/line.c    Mon Jan 06 15:29:52 1992
  470. ***************
  471. *** 229,234 ****
  472. --- 229,235 ----
  473.   * if all is well, and FALSE on errors.
  474.   */
  475.   bool linsert (n, c)
  476. + int    n;
  477.   uchar   c;
  478.   {
  479.       register D8    *cp1;
  480. ***************
  481. *** 335,340 ****
  482. --- 336,342 ----
  483.   */
  484.   bool ldelete (n_bytes, kflag)
  485.   A32    n_bytes;
  486. + int    kflag;
  487.   {
  488.       register LINE  *dotp, *lp, *lp_prev, *lp_next;
  489.       register LPOS  doto, l_cnt;
  490. ***************
  491. *** 402,408 ****
  492.       {   /* wholesale delete by moving lines to save buffer */
  493.           if (doto != 0)
  494.           {
  495. !             if ((lp = l_break_in_two (dotp, doto, 0l)) == NULL)
  496.                   return (FALSE);
  497.           }
  498.           else
  499. --- 404,410 ----
  500.       {   /* wholesale delete by moving lines to save buffer */
  501.           if (doto != 0)
  502.           {
  503. !             if ((lp = l_break_in_two (dotp, doto, 0)) == NULL)
  504.                   return (FALSE);
  505.           }
  506.           else
  507. ***************
  508. *** 417,423 ****
  509.               if (n_byt < lp -> l_used)
  510.               {
  511.                   /* get last piece of a line */
  512. !                 lp_next = l_break_in_two (lp, n_byt, 0l);
  513.               }
  514.               n_byt -= lp -> l_used;
  515.               if (kflag)
  516. --- 419,425 ----
  517.               if (n_byt < lp -> l_used)
  518.               {
  519.                   /* get last piece of a line */
  520. !                 lp_next = l_break_in_two (lp, (LPOS) n_byt, 0);
  521.               }
  522.               n_byt -= lp -> l_used;
  523.               if (kflag)
  524. ***************
  525. *** 546,552 ****
  526.       }
  527.       else if (plen < rlen)
  528.       {
  529. !         if (linsert (rlen - plen, ' ') == FALSE)
  530.               return (FALSE);
  531.       }
  532.       curwp -> w_doto = doto;
  533. --- 548,554 ----
  534.       }
  535.       else if (plen < rlen)
  536.       {
  537. !         if (linsert (rlen - plen, (uchar) ' ') == FALSE)
  538.               return (FALSE);
  539.       }
  540.       curwp -> w_doto = doto;
  541. diff -cb orig/main.c new/main.c
  542. *** orig/main.c    Fri Nov 22 19:03:22 1991
  543. --- new/main.c    Mon Jan 06 15:36:54 1992
  544. ***************
  545. *** 48,53 ****
  546. --- 48,56 ----
  547.   extern    char    MSG_ok[];
  548.   extern    char    MSG_main[];
  549.   extern    char    MSG_prog_name[];
  550. + extern    char    MSG_init_file[];
  551. + extern    char    MSG_init_var[];
  552. + extern    char    MSG_init_path[];
  553.   extern    char    MSG_no_mod[];
  554.   extern    char    MSG_no_s_chg[];
  555.   extern    char    MSG_auto_fl[];
  556. ***************
  557. *** 92,97 ****
  558. --- 95,101 ----
  559.   int     auto_update = 0;
  560.   
  561.   void main (argc, argv)
  562. + int     argc;
  563.   char   *argv[];
  564.   {
  565.   
  566. ***************
  567. *** 100,105 ****
  568. --- 104,110 ----
  569.       register    int     n;
  570.       register    int     mflag;
  571.       char        bname[NBUFN];
  572. +     char        initfile[NFILEN];
  573.   
  574.   #if MSDOS
  575.       is_wang ();                 /* Check for computer type */
  576. ***************
  577. *** 144,150 ****
  578. --- 149,169 ----
  579.           initial_load = 0;
  580.       }
  581.   
  582. + #ifdef OS2
  583. +         _searchenv(MSG_init_file, MSG_init_var, initfile);
  584. +         if ( initfile[0] )
  585. +            check_extend (initfile);
  586. +         else
  587. +         {
  588. +           _searchenv(MSG_init_file, MSG_init_path, initfile);
  589. +           if ( initfile[0] )
  590. +              check_extend (initfile);
  591. +           else
  592. +              check_extend (getenv (MSG_prog_name));
  593. +         }
  594. + #else
  595.       check_extend (NULL);  /* check for extended keys */
  596. + #endif
  597.       save_buf_init();        /* initialize save buffer */
  598.       lastflag = 0;               /* Fake last flags.     */
  599.   
  600. ***************
  601. *** 211,216 ****
  602. --- 230,236 ----
  603.   * entry now). Also fiddle with the flags.
  604.   */
  605.   char    execute (c, f, n)
  606. + int c, f, n;
  607.   {
  608.   
  609.       register    SYMBOL * sp;
  610. ***************
  611. *** 328,333 ****
  612. --- 348,354 ----
  613.   * and quit
  614.   */
  615.   bool flushnquit (f, n, k)
  616. + int f, n, k;
  617.   {
  618.       flush_all ();
  619.       quit (f, n, k);
  620. ***************
  621. *** 342,347 ****
  622. --- 363,369 ----
  623.   * to "C-X C-C".
  624.   */
  625.   char    quit (f, n, k)
  626. + int f, n, k;
  627.   {
  628.   
  629.       register char   s;
  630. ***************
  631. *** 366,371 ****
  632. --- 388,394 ----
  633.   * variables and return.
  634.   */
  635.   bool ctlxlp (f, n, k)
  636. + int f, n, k;
  637.   {
  638.   
  639.       if (kbdmip != NULL || kbdmop != NULL)
  640. ***************
  641. *** 388,393 ****
  642. --- 411,417 ----
  643.   * and return to the caller.
  644.   */
  645.   bool ctlxrp (f, n, k)
  646. + int f, n, k;
  647.   {
  648.   
  649.       if (kbdmip == NULL)
  650. ***************
  651. *** 412,417 ****
  652. --- 436,442 ----
  653.   * FALSE.
  654.   */
  655.   bool ctlxe (f, n, k)
  656. + int f, n, k;
  657.   {
  658.   
  659.       register int    c;
  660. ***************
  661. *** 463,468 ****
  662. --- 488,494 ----
  663.   * stuff.
  664.   */
  665.   char    ctrlg (f, n, k)
  666. + int f, n, k;
  667.   {
  668.       /*    ttbeep (); */
  669.       if (kbdmip != NULL)
  670. ***************
  671. *** 481,486 ****
  672. --- 507,513 ----
  673.   * Don't call display if there is an argument.
  674.   */
  675.   char    showversion (f, n, k)
  676. + int f, n, k;
  677.   {
  678.       static  char    *cp;
  679.       char    buf[NCOL];
  680. diff -cb orig/random.c new/random.c
  681. *** orig/random.c    Fri Nov 22 19:03:20 1991
  682. --- new/random.c    Mon Jan 06 15:37:52 1992
  683. ***************
  684. *** 76,81 ****
  685. --- 76,82 ----
  686.   * This is normally bound to "C-X =".
  687.   */
  688.   bool showcpos (f, n, k)
  689. + int f, n, k;
  690.   {
  691.   
  692.       A32     dotoff,
  693. ***************
  694. *** 192,197 ****
  695. --- 193,199 ----
  696.   * regularity.
  697.   */
  698.   bool quote (f, n, k)
  699. + int f, n, k;
  700.   {
  701.       register int    c;
  702.   
  703. ***************
  704. *** 218,224 ****
  705.       if (n == 0)
  706.           return (TRUE);
  707.   
  708. !     return (linsert (n, c));
  709.   }
  710.   
  711.   /*
  712. --- 220,226 ----
  713.       if (n == 0)
  714.           return (TRUE);
  715.   
  716. !     return (linsert (n, (uchar) c));
  717.   }
  718.   
  719.   /*
  720. ***************
  721. *** 254,259 ****
  722. --- 256,262 ----
  723.   */
  724.   
  725.   bool selfinsert (f, n, k)
  726. + int f, n, k;
  727.   {
  728.   
  729.       register int    c;
  730. ***************
  731. *** 302,317 ****
  732.       switch (curwp -> w_fmt_ptr -> r_type)
  733.       {
  734.       case EBCDIC:
  735. !         c = to_ebcdic (c);  /* convert ASCII to EBCDIC */
  736.       case ASCII:
  737.           if ((insert_mode) || (DOT_POS(curwp) == BUF_SIZE(curwp)))
  738.           {
  739. !             linsert (n, c);
  740.               if (read_pat_mode)
  741.                   forwchar (0, 1, KRANDOM);/* advance the cursor */
  742.           }
  743.           else
  744. !             lreplace (n, c);
  745.           break;
  746.   
  747.       case HEX:
  748. --- 305,320 ----
  749.       switch (curwp -> w_fmt_ptr -> r_type)
  750.       {
  751.       case EBCDIC:
  752. !         c = to_ebcdic ((char) c);  /* convert ASCII to EBCDIC */
  753.       case ASCII:
  754.           if ((insert_mode) || (DOT_POS(curwp) == BUF_SIZE(curwp)))
  755.           {
  756. !             linsert (n, (uchar) c);
  757.               if (read_pat_mode)
  758.                   forwchar (0, 1, KRANDOM);/* advance the cursor */
  759.           }
  760.           else
  761. !             lreplace (n, (char) c);
  762.           break;
  763.   
  764.       case HEX:
  765. ***************
  766. *** 494,500 ****
  767.           {
  768.           case BYTES:
  769.               sprintf (text_buf, MSG_03u, (int) (edt_buf[0] & 0xff));
  770. !             if (!dec_chr_ok (text_buf, max_dec_8, c, u_offs))
  771.               {
  772.                   bad_key (k);
  773.                   return (TRUE);  /* TRUE so that mask will be same len */
  774. --- 497,503 ----
  775.           {
  776.           case BYTES:
  777.               sprintf (text_buf, MSG_03u, (int) (edt_buf[0] & 0xff));
  778. !             if (!dec_chr_ok (text_buf, max_dec_8, (char) c, u_offs))
  779.               {
  780.                   bad_key (k);
  781.                   return (TRUE);  /* TRUE so that mask will be same len */
  782. ***************
  783. *** 506,512 ****
  784.           case WORDS:
  785.               l_val = get_int (edt_buf);/* do intel swap */
  786.               sprintf (text_buf, MSG_05u, (int) (l_val & 0xFFFF));
  787. !             if (!dec_chr_ok (text_buf, max_dec_16, c, u_offs))
  788.               {
  789.                   bad_key (k);
  790.                   return (TRUE);  /* TRUE so that mask will be same len */
  791. --- 509,515 ----
  792.           case WORDS:
  793.               l_val = get_int (edt_buf);/* do intel swap */
  794.               sprintf (text_buf, MSG_05u, (int) (l_val & 0xFFFF));
  795. !             if (!dec_chr_ok (text_buf, max_dec_16, (char) c, u_offs))
  796.               {
  797.                   bad_key (k);
  798.                   return (TRUE);  /* TRUE so that mask will be same len */
  799. ***************
  800. *** 519,525 ****
  801.           case DWORDS:
  802.               l_val = get_long (edt_buf);/* do intel swap */
  803.               sprintf (text_buf, MSG_010lu, l_val);
  804. !             if (!dec_chr_ok (text_buf, max_dec_32, c, u_offs))
  805.               {
  806.                   bad_key (k);
  807.                   return (TRUE);  /* TRUE so that mask will be same len */
  808. --- 522,528 ----
  809.           case DWORDS:
  810.               l_val = get_long (edt_buf);/* do intel swap */
  811.               sprintf (text_buf, MSG_010lu, l_val);
  812. !             if (!dec_chr_ok (text_buf, max_dec_32, (char) c, u_offs))
  813.               {
  814.                   bad_key (k);
  815.                   return (TRUE);  /* TRUE so that mask will be same len */
  816. ***************
  817. *** 568,573 ****
  818. --- 571,577 ----
  819.   *   Insert one unit of zeros at the current dot position.
  820.   */
  821.   bool    insertunit (f, n, k)
  822. + int f, n, k;
  823.   {
  824.       lchange (WFEDIT);
  825.       linsert ((R_B_PER_U(curwp) * n), 0);
  826. ***************
  827. *** 629,640 ****
  828.   */
  829.   
  830.   char    dec_chr_ok (char_buf, max_str, chr, pos)
  831. ! char    chr,
  832. ! pos,
  833. ! *char_buf,
  834. ! *max_str;
  835.   {
  836.       char    i;
  837.   
  838. --- 633,640 ----
  839.   */
  840.   
  841.   char    dec_chr_ok (char_buf, max_str, chr, pos)
  842. ! char    chr, pos;
  843. ! char    *char_buf, *max_str;
  844.   {
  845.       char    i;
  846.   
  847. ***************
  848. *** 812,817 ****
  849. --- 812,818 ----
  850.   * from the correct offset.
  851.   */
  852.   bool dispshift (f, n, k)
  853. + int f, n, k;
  854.   {
  855.       char    mode,
  856.       size;
  857. ***************
  858. *** 865,870 ****
  859. --- 866,872 ----
  860.   * Normally bound to "C-D".
  861.   */
  862.   char    forwdel (f, n, k)
  863. + int f, n, k;
  864.   {
  865.       char    s;
  866.   
  867. ***************
  868. *** 896,901 ****
  869. --- 898,904 ----
  870.   * if presented with an argument.
  871.   */
  872.   char    backdel (f, n, k)
  873. + int f, n, k;
  874.   {
  875.   
  876.       int     u_off;
  877. ***************
  878. *** 1064,1069 ****
  879. --- 1067,1073 ----
  880.   * in the way that the INTEL microprocessors do it.
  881.   */
  882.   bool dispswapbyte (f, n, k)
  883. + int f, n, k;
  884.   {
  885.       if ((curwp -> w_fmt_ptr -> r_size) == BYTES)
  886.           return (TRUE);
  887. ***************
  888. *** 1089,1094 ****
  889. --- 1093,1099 ----
  890.   * text landed off screen).
  891.   */
  892.   bool yank (f, n, k)
  893. + int f, n, k;
  894.   {
  895.       register D16    c;
  896.       register A32    i;
  897. ***************
  898. *** 1102,1108 ****
  899.           save_buf_home ();
  900.           while ((c = get_save_char ()) != (D16)-1)
  901.           {
  902. !             if (linsert (1, c) == FALSE)
  903.                   return (FALSE);
  904.               if ((i & 0x2ff) == 0)
  905.               {
  906. --- 1107,1113 ----
  907.           save_buf_home ();
  908.           while ((c = get_save_char ()) != (D16)-1)
  909.           {
  910. !             if (linsert (1, (uchar) c) == FALSE)
  911.                   return (FALSE);
  912.               if ((i & 0x2ff) == 0)
  913.               {
  914. ***************
  915. *** 1179,1184 ****
  916. --- 1184,1190 ----
  917.    *    image files from odd and even bytes into one file.
  918.    */
  919.   bool    n_way_combine (f, n, k)
  920. + int     f, n, k;
  921.   {
  922.       WINDOW * dest_wp, *src_wp;
  923.       BUFFER *src_bp;
  924. ***************
  925. *** 1264,1269 ****
  926. --- 1270,1276 ----
  927.    *    image files.
  928.    */
  929.   bool    n_way_split (f, n, k)
  930. + int     f, n, k;
  931.   {
  932.       WINDOW  *src_wp;
  933.       A32     b_size;
  934. ***************
  935. *** 1355,1357 ****
  936. --- 1362,1365 ----
  937.           nextwind();
  938.       }    while (wp != curwp);
  939.   }
  940. diff -cb orig/region.c new/region.c
  941. *** orig/region.c    Fri Nov 22 19:03:26 1991
  942. --- new/region.c    Mon Jan 06 15:30:00 1992
  943. ***************
  944. *** 23,28 ****
  945. --- 23,29 ----
  946.   * Move "." to the start, and kill the characters.
  947.   */
  948.   char    killregion (f, n, k)
  949. + int f, n, k;
  950.   {
  951.       register char   s;
  952.       REGION region;
  953. ***************
  954. *** 52,57 ****
  955. --- 53,59 ----
  956.   * by a yank.
  957.   */
  958.   char    copyregion (f, n, k)
  959. + int f, n, k;
  960.   {
  961.       register    LINE * linep;
  962.       register int    loffs, j;
  963. ***************
  964. *** 69,75 ****
  965.       loffs = region.r_offset;    /* Current offset.  */
  966.       while (region.r_size--)
  967.       {
  968. !         if ((s = b_append_c (&sav_buf, lgetc (linep, loffs))) != TRUE)
  969.               return (s);
  970.           ++loffs;
  971.           if ((j++ & 0x2ff) == 0)
  972. --- 71,77 ----
  973.       loffs = region.r_offset;    /* Current offset.  */
  974.       while (region.r_size--)
  975.       {
  976. !         if ((s = b_append_c (&sav_buf, (uchar) lgetc (linep, loffs))) != TRUE)
  977.               return (s);
  978.           ++loffs;
  979.           if ((j++ & 0x2ff) == 0)
  980. ***************
  981. *** 140,145 ****
  982. --- 142,148 ----
  983.   * and doesn't do clever things at all with dot in destination buffer!
  984.   */
  985.   char    save_region (f, n, k)
  986. + int f, n, k;
  987.   {
  988.       char    bufn[NBUFN];
  989.       char    oldbufn[NBUFN];
  990. diff -cb orig/search.c new/search.c
  991. *** orig/search.c    Fri Nov 22 19:03:18 1991
  992. --- new/search.c    Mon Jan 06 15:30:02 1992
  993. ***************
  994. *** 230,235 ****
  995. --- 230,236 ----
  996.   * (note typical hack to add a function with minimal code)
  997.   */
  998.   char    queryrepl (f, n, k)
  999. + int f, n, k;
  1000.   {
  1001.   
  1002.       register char   s;
  1003. ***************
  1004. *** 645,651 ****
  1005.   
  1006.           cod = getkey ();
  1007.   
  1008. !         if (cod == 0x014D)  /* check for return */
  1009.           {
  1010.               if ((rplc_mode == TRUE) && (cur_prompt == MSG_sch_str))
  1011.               {
  1012. --- 646,652 ----
  1013.   
  1014.           cod = getkey ();
  1015.   
  1016. !             if (cod == 0x014D || cod == 0x014A)  /* check for return or linefeed */
  1017.           {
  1018.               if ((rplc_mode == TRUE) && (cur_prompt == MSG_sch_str))
  1019.               {
  1020. diff -cb orig/spawn.c new/spawn.c
  1021. *** orig/spawn.c    Fri Nov 22 19:03:20 1991
  1022. --- new/spawn.c    Mon Jan 06 15:39:46 1992
  1023. ***************
  1024. *** 3,8 ****
  1025. --- 3,12 ----
  1026.   */
  1027.   #include        "def.h"
  1028.   
  1029. + #ifdef OS2
  1030. + #define MSDOS  1
  1031. + #endif
  1032.   extern    char    MSG_shell[];
  1033.   extern    char    MSG_def_shell[];
  1034.   extern    char    MSG_pmpt[];
  1035. ***************
  1036. *** 11,17 ****
  1037.   extern    char    MSG_null[];
  1038.   
  1039.   /* #include     <dos.h> */
  1040. ! #if MSDOS
  1041.   #include        "process.h"
  1042.   #endif
  1043.   char   *cspec = NULL;           /* Command string.      */
  1044. --- 15,21 ----
  1045.   extern    char    MSG_null[];
  1046.   
  1047.   /* #include     <dos.h> */
  1048. ! #ifdef MSDOS
  1049.   #include        "process.h"
  1050.   #endif
  1051.   char   *cspec = NULL;           /* Command string.      */
  1052. ***************
  1053. *** 24,40 ****
  1054.   * garbage so that you do a full repaint.
  1055.   */
  1056.   bool spawncli (f, n, k)
  1057.   {
  1058. ! #if MSDOS
  1059.   
  1060.       char   *getenv ();
  1061.       char    old_prompt[NCOL];
  1062.       char    prompt_line[NCOL];
  1063.   
  1064.       ttcolor (CTEXT);            /* Normal color.        */
  1065.       ttmove (nrow - 1, 0);       /* Last line.           */
  1066.       ttflush ();
  1067.       ttcooked ();
  1068.   #ifndef IBM
  1069.       strcpy (prompt_line, MSG_pmpt);
  1070.       pspec = getenv (MSG_pt);
  1071. --- 28,48 ----
  1072.   * garbage so that you do a full repaint.
  1073.   */
  1074.   bool spawncli (f, n, k)
  1075. + int f, n, k;
  1076.   {
  1077. ! #ifdef MSDOS
  1078.   
  1079.       char   *getenv ();
  1080. + #ifndef OS2
  1081.       char    old_prompt[NCOL];
  1082.       char    prompt_line[NCOL];
  1083. + #endif
  1084.   
  1085.       ttcolor (CTEXT);            /* Normal color.        */
  1086.       ttmove (nrow - 1, 0);       /* Last line.           */
  1087.       ttflush ();
  1088.       ttcooked ();
  1089. + #ifndef OS2
  1090.   #ifndef IBM
  1091.       strcpy (prompt_line, MSG_pmpt);
  1092.       pspec = getenv (MSG_pt);
  1093. ***************
  1094. *** 51,62 ****
  1095. --- 59,73 ----
  1096.               exit (1);
  1097.   
  1098.   #endif
  1099. + #endif
  1100.       if (!cspec && !(cspec = getenv (MSG_shell)))/* jam */
  1101.           cspec = MSG_def_shell;
  1102.       spawnl (P_WAIT, cspec, MSG_null, NULL);
  1103. + #ifndef OS2
  1104.       putenv (MSG_pme);
  1105.       if (putenv (old_prompt) == -1)
  1106.           exit (1);
  1107. + #endif
  1108.       ttraw ();
  1109.       sgarbf = TRUE;
  1110.   #endif
  1111. diff -cb orig/symbol.c new/symbol.c
  1112. *** orig/symbol.c    Fri Nov 22 19:03:20 1991
  1113. --- new/symbol.c    Mon Jan 06 15:30:04 1992
  1114. ***************
  1115. *** 426,432 ****
  1116.       for (i = 0; i < NKEYS; ++i)
  1117.           binding[i] = NULL;
  1118.       for (kp = &key[0]; kp < &key[NKEY]; ++kp)
  1119. !         keyadd (kp -> k_key, kp -> k_funcp, kp -> k_name, kp -> k_modify);
  1120.       keydup (KCTLX | KCTRL | 'G', MSG_abort);
  1121.       keydup (KMETA | KCTRL | 'G', MSG_abort);
  1122.       keydup (0x7F, MSG_back_del_char);
  1123. --- 428,434 ----
  1124.       for (i = 0; i < NKEYS; ++i)
  1125.           binding[i] = NULL;
  1126.       for (kp = &key[0]; kp < &key[NKEY]; ++kp)
  1127. !         keyadd (kp -> k_key, (bool (*)()) kp -> k_funcp, kp -> k_name, kp -> k_modify);
  1128.       keydup (KCTLX | KCTRL | 'G', MSG_abort);
  1129.       keydup (KMETA | KCTRL | 'G', MSG_abort);
  1130.       keydup (0x7F, MSG_back_del_char);
  1131. ***************
  1132. *** 455,460 ****
  1133. --- 457,463 ----
  1134.   * are fatal.
  1135.   */
  1136.   void keyadd (new, funcp, name, modify)
  1137. + int    new, modify;
  1138.   bool   (*funcp) ();
  1139.   char   *name;
  1140.   {
  1141. diff -cb orig/tcap.c new/tcap.c
  1142. *** orig/tcap.c    Fri Nov 22 19:03:26 1991
  1143. --- new/tcap.c    Mon Jan 06 15:41:22 1992
  1144. ***************
  1145. *** 6,11 ****
  1146. --- 6,17 ----
  1147.   
  1148.   #ifdef UNIX
  1149.   
  1150. + #ifdef OS2
  1151. + #define INCL_NOPM
  1152. + #define INCL_VIO
  1153. + #include <os2.h>
  1154. + #endif
  1155.   #define    MARGIN    8
  1156.   #define    SCRSIZ    64
  1157.   #define    NPAUSE    10            /* # times thru update to pause */
  1158. ***************
  1159. *** 19,25 ****
  1160.   void    putpad();
  1161.   #endif
  1162.   
  1163. ! #ifdef    COLOR
  1164.   extern int        tcapfcol();
  1165.   extern int        tcapbcol();
  1166.   #endif
  1167. --- 25,31 ----
  1168.   void    putpad();
  1169.   #endif
  1170.   
  1171. ! #ifdef USECOLOR
  1172.   extern int        tcapfcol();
  1173.   extern int        tcapbcol();
  1174.   #endif
  1175. ***************
  1176. *** 26,32 ****
  1177.   
  1178.   #define TCAPSLEN 315
  1179.   char tcapbuf[TCAPSLEN];
  1180. ! char *UP, PC, *CM, *CE, *CL, *SO, *SE;
  1181.   
  1182.   #ifdef BSD
  1183.   #include <sys/ioctl.h>
  1184. --- 32,38 ----
  1185.   
  1186.   #define TCAPSLEN 315
  1187.   char tcapbuf[TCAPSLEN];
  1188. ! char *UP, PC, *CM, *CE, *CL, *SO, *SE, *TI, *TE;
  1189.   
  1190.   #ifdef BSD
  1191.   #include <sys/ioctl.h>
  1192. ***************
  1193. *** 55,63 ****
  1194. --- 61,73 ----
  1195.   
  1196.       if ((tv_stype = getenv("TERM")) == NULL)
  1197.       {
  1198. + #ifndef OS2
  1199.           puts("Environment variable TERM not defined!\r");
  1200.           ttclose();
  1201.           exit(1);
  1202. + #else
  1203. +                 tv_stype = "ansi";
  1204. + #endif
  1205.       }
  1206.   
  1207.       if ((tgetent(tcbuf, tv_stype)) != 1)
  1208. ***************
  1209. *** 83,88 ****
  1210. --- 93,99 ----
  1211.           else
  1212.   #endif /* ULTRIX */
  1213.   #endif /* BSD */
  1214. + #ifndef OS2
  1215.               if ((nrow=(short)tgetnum("li")-1) == -1){
  1216.                   puts("termcap entry incomplete (lines)\r");
  1217.                   ttclose();    /* fix in 1.13 */
  1218. ***************
  1219. *** 90,96 ****
  1220.               }
  1221.       printf ("nrow %d, ncol %d\n", nrow, ncol);
  1222.       /* don't allow to specify a larger number of rows than we can handle 1.13 */
  1223. !     if (nrow > NROW)
  1224.           nrow = NROW;
  1225.   
  1226.       if ((ncol=(short)tgetnum("co")) == -1){
  1227. --- 101,107 ----
  1228.               }
  1229.       printf ("nrow %d, ncol %d\n", nrow, ncol);
  1230.       /* don't allow to specify a larger number of rows than we can handle 1.13 */
  1231. !     if (nrow > NMAXROW)
  1232.           nrow = NROW;
  1233.   
  1234.       if ((ncol=(short)tgetnum("co")) == -1){
  1235. ***************
  1236. *** 99,112 ****
  1237.           exit(1);
  1238.       }
  1239.       /* don't allow to specify a larger number of cols than we can handle 1.13 */
  1240. !     if (ncol > NCOL)
  1241.           ncol = NCOL;
  1242.   
  1243.       p = tcapbuf;
  1244.       t = tgetstr("pc", &p);
  1245.       if(t)
  1246.           PC = *t;
  1247.   
  1248.       CL = tgetstr("cl", &p);
  1249.       CM = tgetstr("cm", &p);
  1250.       CE = tgetstr("ce", &p);
  1251. --- 110,135 ----
  1252.           exit(1);
  1253.       }
  1254.       /* don't allow to specify a larger number of cols than we can handle 1.13 */
  1255. !     if (ncol > NMAXCOL)
  1256.           ncol = NCOL;
  1257. + #else
  1258. +         {
  1259. +            VIOMODEINFO viomi;
  1260.   
  1261. +            viomi.cb = sizeof(viomi);
  1262. +            VioGetMode(&viomi, 0);
  1263. +            nrow = viomi.row;
  1264. +            ncol = viomi.col;
  1265. +         }
  1266. + #endif
  1267.       p = tcapbuf;
  1268.       t = tgetstr("pc", &p);
  1269.       if(t)
  1270.           PC = *t;
  1271.   
  1272. +     TI = tgetstr("ti", &p);
  1273. +     TE = tgetstr("te", &p);
  1274.       CL = tgetstr("cl", &p);
  1275.       CM = tgetstr("cm", &p);
  1276.       CE = tgetstr("ce", &p);
  1277. ***************
  1278. *** 145,150 ****
  1279. --- 168,179 ----
  1280.       putpad(CL);
  1281.   }
  1282.   
  1283. + void    tcapinit(init)
  1284. + int init;
  1285. + {
  1286. +         putpad(init ? TI : TE);
  1287. + }
  1288.   void    tcaprev(state)        /* change reverse video status */
  1289.   int state;        /* FALSE = normal video, TRUE = reverse video */
  1290.   
  1291. ***************
  1292. *** 159,164 ****
  1293. --- 188,194 ----
  1294.   
  1295.   void    putnpad(str, n)
  1296.   char    *str;
  1297. + int n;
  1298.   {
  1299.       tputs(str, n, ttputc);
  1300.   }
  1301. diff -cb orig/termio.c new/termio.c
  1302. *** orig/termio.c    Fri Nov 22 19:03:24 1991
  1303. --- new/termio.c    Mon Jan 06 15:51:50 1992
  1304. ***************
  1305. *** 13,19 ****
  1306. --- 13,32 ----
  1307.   #ifdef BSD
  1308.   #include    <sys/ioctl.h>
  1309.   #else
  1310. + #ifdef OS2
  1311. + #define INCL_NOPM
  1312. + #define INCL_DOS
  1313. + #define INCL_KBD
  1314. + #include    <os2.h>
  1315. + #include    <io.h>
  1316. + #else
  1317. + #ifdef MINIX
  1318. + #include    <sgtty.h>
  1319. + #define O_NDELAY O_NONBLOCK
  1320. + #else
  1321.   #include    <termio.h>
  1322. + #endif /* MINIX */
  1323. + #endif /* OS2 */
  1324.   #endif /* BSD */
  1325.   #include    <errno.h>
  1326.   #include    <fcntl.h>
  1327. ***************
  1328. *** 27,36 ****
  1329. --- 40,62 ----
  1330.   struct    sgttyb    otermb;
  1331.   struct    sgttyb    ntermb;
  1332.   #else
  1333. + #ifdef OS2
  1334. + KBDINFO kbst, kbst_std;
  1335. + #else
  1336. + #ifdef MINIX
  1337. + struct  sgttyb  otermio;    /* original terminal characteristics */
  1338. + struct  sgttyb  ntermio;    /* charactoristics to use inside */
  1339. + struct  tchars  tchars, tcharsorig;
  1340. + #else
  1341.   struct  termio  otermio;    /* original terminal characteristics */
  1342.   struct  termio  ntermio;    /* charactoristics to use inside */
  1343. + #endif /* MINIX */
  1344. + #endif /* OS2 */
  1345.   #endif /* BSD */
  1346. + #ifndef OS2
  1347.   extern    errno; /* System error number -- Necessary when compiling in BSD 1.13 */
  1348. + #endif
  1349.   
  1350.   int     nrow;                   /* Terminal size, rows.         */
  1351.   int     ncol;                   /* Terminal size, columns.      */
  1352. ***************
  1353. *** 75,80 ****
  1354. --- 101,121 ----
  1355.               ncol = NCOL;
  1356.           }
  1357.   #else
  1358. + #ifdef OS2
  1359. +         setmode(1, O_BINARY);
  1360. + #else
  1361. + #ifdef MINIX
  1362. +     ioctl(0, TIOCGETP, &otermio);
  1363. +         ntermio = otermio;
  1364. +         ntermio.sg_flags &= ~ECHO;
  1365. +         ntermio.sg_flags |= RAW;
  1366. +         ioctl(0, TIOCSETP, &ntermio);
  1367. +         ioctl(0, TIOCGETC, &tcharsorig);
  1368. +         tchars = tcharsorig;
  1369. +         tchars.t_intrc = tchars.t_quitc = tchars.t_startc =
  1370. +     tchars.t_stopc = tchars.t_eofc = tchars.t_brkc = -1;
  1371. +         ioctl(0, TIOCSETC, &tchars);
  1372. + #else
  1373.           ioctl(0, TCGETA, &otermio); /* save old settings */
  1374.           ntermio.c_iflag = 0;        /* setup new settings */
  1375.           ntermio.c_oflag = 0;
  1376. ***************
  1377. *** 84,91 ****
  1378. --- 125,134 ----
  1379.           ntermio.c_cc[VMIN] = 1;
  1380.           ntermio.c_cc[VTIME] = 0;
  1381.           ioctl(0, TCSETAW, &ntermio); /* and activate them */
  1382. + #endif /* MINIX */
  1383.           kbdflgs = fcntl( 0, F_GETFL, 0 );
  1384.           kbdpoll = FALSE;
  1385. + #endif /* OS2 */
  1386.           /* on all screens we are not sure of the initial position
  1387.          of the cursor                    */
  1388.           ttrow = 999;
  1389. ***************
  1390. *** 92,99 ****
  1391.           ttcol = 999;
  1392.           nrow = NROW;
  1393.           ncol = NCOL;
  1394. ! #endif
  1395. !     }
  1396.   
  1397.       /*
  1398.    * This function gets called just before we go back home to the command
  1399. --- 135,142 ----
  1400.           ttcol = 999;
  1401.           nrow = NROW;
  1402.           ncol = NCOL;
  1403. ! #endif /* BSD */
  1404. ! }
  1405.   
  1406.       /*
  1407.    * This function gets called just before we go back home to the command
  1408. ***************
  1409. *** 100,118 ****
  1410.    * interpreter. On VMS it puts the terminal back in a reasonable state.
  1411.    * Another no-operation on CPM.
  1412.    */
  1413. !     void  ttclose()
  1414. !         {
  1415.   #ifdef BSD
  1416.           if (ioctl(0, TIOCSETP, &otermb) == -1) /* restore terminal settings */
  1417.               printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
  1418.   #else
  1419.           if (ioctl(0, TCSETAW, &otermio) == -1) /* restore terminal settings */
  1420.               printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
  1421.           if (fcntl(0, F_SETFL, kbdflgs) == -1)
  1422.               printf ("closing fcntl on dev 0 failure, error = %d\n", errno);
  1423. ! #endif
  1424.   
  1425. !     }
  1426.   
  1427.       /*
  1428.    * Write a character to the display. On VMS, terminal output is buffered, and
  1429. --- 143,195 ----
  1430.    * interpreter. On VMS it puts the terminal back in a reasonable state.
  1431.    * Another no-operation on CPM.
  1432.    */
  1433. ! void  ttclose()
  1434. ! {
  1435.   #ifdef BSD
  1436.           if (ioctl(0, TIOCSETP, &otermb) == -1) /* restore terminal settings */
  1437.               printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
  1438.   #else
  1439. + #ifdef OS2
  1440. +         setmode(1, O_TEXT);
  1441. + #else
  1442. + #ifdef MINIX
  1443. +         if (ioctl(0, TIOCSETP, &otermio) == -1 ||
  1444. +             ioctl(0, TIOCSETC, &tcharsorig) == -1 )
  1445. +         printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
  1446. + #else
  1447.           if (ioctl(0, TCSETAW, &otermio) == -1) /* restore terminal settings */
  1448.               printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
  1449. + #endif /* MINIX */
  1450.           if (fcntl(0, F_SETFL, kbdflgs) == -1)
  1451.               printf ("closing fcntl on dev 0 failure, error = %d\n", errno);
  1452. ! #endif /* OS2 */
  1453. ! #endif /* BSD */
  1454. ! }
  1455.   
  1456. ! #ifdef OS2
  1457. ! void ttraw(void)
  1458. ! {
  1459. !     PFNSIGHANDLER oldhandler;
  1460. !     USHORT oldact;
  1461. !     DosSetSigHandler((PFNSIGHANDLER) NULL, &oldhandler, &oldact,
  1462. !                      SIGA_IGNORE, SIG_CTRLBREAK);
  1463. !     DosSetSigHandler((PFNSIGHANDLER) NULL, &oldhandler, &oldact,
  1464. !                      SIGA_IGNORE, SIG_CTRLC);
  1465. !     kbst_std.cb = sizeof(kbst_std);
  1466. !     KbdGetStatus(&kbst_std, 0);
  1467. !     kbst = kbst_std;
  1468. !     kbst.fsMask &= ~(KEYBOARD_ECHO_ON  | KEYBOARD_ASCII_MODE | KEYBOARD_SHIFT_REPORT);
  1469. !     kbst.fsMask |=  (KEYBOARD_ECHO_OFF | KEYBOARD_BINARY_MODE);
  1470. !     KbdSetStatus(&kbst, 0);
  1471. ! }
  1472. ! void ttcooked(void)
  1473. ! {
  1474. !     KbdSetStatus(&kbst_std, 0);
  1475. ! }
  1476. ! #endif
  1477.     
  1478.       /*
  1479.    * Write a character to the display. On VMS, terminal output is buffered, and
  1480. ***************
  1481. *** 120,138 ****
  1482.    * On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
  1483.    * MS-DOS (use the very very raw console output routine).
  1484.    */
  1485. !     void ttputc(c)
  1486.           {
  1487. !         fputc(c, stdout);
  1488.       }
  1489.   
  1490.       /*
  1491.    * Flush terminal buffer. Does real work where the terminal output is buffered
  1492.    * up. A no-operation on systems where byte at a time terminal I/O is done.
  1493.    */
  1494. !     void ttflush()
  1495.           {
  1496. !         fflush(stdout);
  1497.       }
  1498.   
  1499.       /*
  1500.    * Read a character from the terminal, performing no editing and doing no echo
  1501. --- 197,240 ----
  1502.    * On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
  1503.    * MS-DOS (use the very very raw console output routine).
  1504.    */
  1505. ! #ifdef OS2
  1506. ! static int size = 0;
  1507. ! static char buffer[2048];
  1508. ! #endif
  1509. ! void ttputc(c)
  1510. ! int c;
  1511. ! {
  1512. ! #ifdef OS2
  1513. !         if ( size == sizeof(buffer) )
  1514.           {
  1515. !           write(1, buffer, size);
  1516. !           size = 0;
  1517.           }
  1518.   
  1519. +         buffer[size++] = c;
  1520. + #else
  1521. +     fputc(c, stdout);
  1522. + #endif
  1523. + }
  1524.       /*
  1525.    * Flush terminal buffer. Does real work where the terminal output is buffered
  1526.    * up. A no-operation on systems where byte at a time terminal I/O is done.
  1527.    */
  1528. ! void ttflush()
  1529. ! {
  1530. ! #ifdef OS2
  1531. !         if ( size )
  1532.           {
  1533. !           write(1, buffer, size);
  1534. !           size = 0;
  1535.           }
  1536. + #else
  1537. +     fflush(stdout);
  1538. + #endif
  1539. + }
  1540.   
  1541.       /*
  1542.    * Read a character from the terminal, performing no editing and doing no echo
  1543. ***************
  1544. *** 139,146 ****
  1545.    * at all. More complex in VMS that almost anyplace else, which figures. Very
  1546.    * simple on CPM, because the system can do exactly what you want.
  1547.    */
  1548. !     ttgetc()
  1549.           {
  1550.           if( kbdqp )
  1551.               kbdqp = FALSE;
  1552.           else
  1553. --- 241,272 ----
  1554.    * at all. More complex in VMS that almost anyplace else, which figures. Very
  1555.    * simple on CPM, because the system can do exactly what you want.
  1556.    */
  1557. ! ttgetc()
  1558. ! {
  1559. ! #ifdef OS2
  1560. !         static int ext, scan;
  1561. !         KBDKEYINFO ki;
  1562. !         if ( ext )
  1563. !         {
  1564. !             ext = 0;
  1565. !             return scan;
  1566. !         }
  1567. !         else
  1568.           {
  1569. +               ttflush();
  1570. +               KbdCharIn(&ki, IO_WAIT, 0);
  1571. +               if ( ki.chChar == 0 || ki.chChar == 0xE0 )
  1572. +             {
  1573. +                 ext = 1;
  1574. +                     scan = ki.chScan;
  1575. +                     return 0xE0;
  1576. +               }
  1577. +               else
  1578. +                     return ki.chChar;
  1579. +         }
  1580. + #else
  1581.       if( kbdqp )
  1582.           kbdqp = FALSE;
  1583.       else
  1584. ***************
  1585. *** 157,172 ****
  1586.               kbdpoll = FALSE;
  1587.               while (read(0, &kbdq, 1) != 1)
  1588.                   ;
  1589. ! #endif
  1590.           }
  1591.           return ( kbdq & 127 );
  1592. !     }
  1593.   
  1594. !     /* typahead():    Check to see if any characters are already in the
  1595.           keyboard buffer
  1596.   */
  1597. !     ttkeyready ()
  1598. !         {
  1599.           if( !kbdqp )
  1600.           {
  1601.   #ifdef BSD
  1602. --- 283,305 ----
  1603.           kbdpoll = FALSE;
  1604.           while (read(0, &kbdq, 1) != 1)
  1605.               ;
  1606. ! #endif /* BSD */
  1607.       }
  1608.       return ( kbdq & 127 );
  1609. ! #endif /* OS2 */
  1610. ! }
  1611.   
  1612. ! /* typahead():    Check to see if any characters are already in the
  1613.      keyboard buffer
  1614.   */
  1615. ! ttkeyready ()
  1616. ! {
  1617. ! #ifdef OS2
  1618. !         KBDKEYINFO ki;
  1619. !         KbdPeek(&ki, 0);
  1620. !         return (ki.fbStatus != 0);
  1621. ! #else
  1622.       if( !kbdqp )
  1623.       {
  1624.   #ifdef BSD
  1625. ***************
  1626. *** 177,189 ****
  1627.               kbdpoll = TRUE;    /*  fix in 1.13 */
  1628.               kbdqp = TRUE;
  1629.   #else
  1630.               if( !kbdpoll && fcntl( 0, F_SETFL, kbdflgs | O_NDELAY ) < 0 )
  1631.                   return(FALSE);
  1632.               kbdpoll = TRUE;    /*  fix in 1.13 */
  1633.               kbdqp = (1 == read( 0, &kbdq, 1 ));
  1634. ! #endif
  1635.   
  1636.           }
  1637.           return ( kbdqp );
  1638. !     }
  1639.   #endif
  1640. --- 310,328 ----
  1641.           kbdpoll = TRUE;    /*  fix in 1.13 */
  1642.           kbdqp = TRUE;
  1643.   #else
  1644. + #ifdef X_MINIX
  1645. +     /* MINIX has non-blocking mode but it doesn't work !?!? */
  1646. +         return FALSE;
  1647. + #else
  1648.           if( !kbdpoll && fcntl( 0, F_SETFL, kbdflgs | O_NDELAY ) < 0 )
  1649.               return(FALSE);
  1650.           kbdpoll = TRUE;    /*  fix in 1.13 */
  1651.           kbdqp = (1 == read( 0, &kbdq, 1 ));
  1652. ! #endif /* MINIX */
  1653. ! #endif /* BSD */
  1654.   
  1655.       }
  1656.       return ( kbdqp );
  1657. ! #endif /* OS2 */
  1658. ! }
  1659.   #endif
  1660. diff -cb orig/text.c new/text.c
  1661. *** orig/text.c    Fri Nov 22 19:03:16 1991
  1662. --- new/text.c    Mon Jan 06 15:30:10 1992
  1663. ***************
  1664. *** 8,16 ****
  1665.   char    MSG_no_mark[]   = "No mark in this window";
  1666.   char    MSG_go_b_n[]    = "Goto byte number: ";
  1667.   char    MSG_bad_num[]   = "ERROR: Bad number";
  1668. ! char    MSG_lX[]        = "%lX";
  1669. ! char    MSG_lO[]        = "%lO";
  1670. ! char    MSG_lD[]        = "%lD";
  1671.   
  1672.   /* in buffer.c */
  1673.   char    MSG_use_b[]     = "Enter name of buffer to goto: ";
  1674. --- 8,16 ----
  1675.   char    MSG_no_mark[]   = "No mark in this window";
  1676.   char    MSG_go_b_n[]    = "Goto byte number: ";
  1677.   char    MSG_bad_num[]   = "ERROR: Bad number";
  1678. ! char    MSG_lX[]        = "%lx";
  1679. ! char    MSG_lO[]        = "%lo";
  1680. ! char    MSG_lD[]        = "%ld";
  1681.   
  1682.   /* in buffer.c */
  1683.   char    MSG_use_b[]     = "Enter name of buffer to goto: ";
  1684. ***************
  1685. *** 50,55 ****
  1686. --- 50,58 ----
  1687.   char    MSG_04X[]       = "%04X";
  1688.   char    MSG_08lX[]      = "%08lX";
  1689.   char    MSG_prog_name[] = "BEAV";
  1690. + char    MSG_init_file[] = "beav.ini";
  1691. + char    MSG_init_var[]  = "INIT";
  1692. + char    MSG_init_path[] = "PATH";
  1693.   char    MSG_disp_b_lst[]= " Buffer List ";
  1694.   char    MSG_file[]      = "File: ";
  1695.   char    MSG_RO[]        = " [RO]";
  1696. ***************
  1697. *** 215,221 ****
  1698. --- 218,228 ----
  1699.   
  1700.   /* in spawn.c */
  1701.   char    MSG_shell[]     = "COMSPEC";
  1702. + #ifndef OS2
  1703.   char    MSG_def_shell[] = "/command.com";
  1704. + #else
  1705. + char    MSG_def_shell[] = "c:/os2/cmd.exe";
  1706. + #endif
  1707.   char    MSG_pmpt[]      = "PROMPT=[BEAV]";
  1708.   char    MSG_pt[]        = "PROMPT";
  1709.   char    MSG_pme[]       = "PROMPT=";
  1710. diff -cb orig/tty.c new/tty.c
  1711. *** orig/tty.c    Fri Nov 22 19:03:26 1991
  1712. --- new/tty.c    Mon Jan 06 15:30:12 1992
  1713. ***************
  1714. *** 13,20 ****
  1715.   void    asciiparm ();
  1716.   void    ttnowindow ();    /* stub */
  1717.   void    ttcolor ();
  1718. ! extern void tcapopen ();
  1719. ! extern void tcapmove ();
  1720.   
  1721.   #ifdef MSDOS
  1722.   #include    "dos.h"
  1723. --- 13,20 ----
  1724.   void    asciiparm ();
  1725.   void    ttnowindow ();    /* stub */
  1726.   void    ttcolor ();
  1727. ! int    tcapopen ();
  1728. ! int    tcapmove ();
  1729.   
  1730.   #ifdef MSDOS
  1731.   #include    "dos.h"
  1732. ***************
  1733. *** 41,48 ****
  1734. --- 41,54 ----
  1735.   #ifdef MSDOS
  1736.       ttraw ();
  1737.   #endif
  1738. + #ifdef OS2
  1739. +     ttraw ();
  1740. + #endif
  1741.   #ifdef UNIX
  1742.       tcapopen();
  1743. +     tcapinit(1);
  1744. +     tcapmove(0, 0);
  1745. +     tcapeeop();
  1746.   #endif
  1747.   }
  1748.   
  1749. ***************
  1750. *** 55,60 ****
  1751. --- 61,74 ----
  1752.   #ifdef MSDOS
  1753.       ttcooked ();
  1754.   #endif
  1755. + #ifdef OS2
  1756. +     ttcooked ();
  1757. + #endif
  1758. + #ifdef UNIX
  1759. +     tcapinit(0);
  1760. +     tcapmove(0, 0);
  1761. +     tcapeeop();
  1762. + #endif
  1763.   }
  1764.   
  1765.   /*
  1766. ***************
  1767. *** 65,70 ****
  1768. --- 79,85 ----
  1769.   * location last time!
  1770.   */
  1771.   void    ttmove (row, col)
  1772. + int row, col;
  1773.   {
  1774.   #ifdef MSDOS
  1775.       union   REGS    regs;
  1776. diff -cb orig/ttykbd.c new/ttykbd.c
  1777. *** orig/ttykbd.c    Fri Nov 22 19:03:24 1991
  1778. --- new/ttykbd.c    Mon Jan 06 15:56:08 1992
  1779. ***************
  1780. *** 111,118 ****
  1781.   #endif
  1782.   /*
  1783.    * The keyboard's special characters, those things that are prefixed with
  1784. !  * a 0x1F, are placed into the keyboard tables as KCTRL || 0x80 || x, for some
  1785. !  * x, i.e. they have both the control and 0x80 bits set, so they won't conflict
  1786.    * with anything else on the keyboard.
  1787.    */
  1788.   
  1789. --- 111,118 ----
  1790.   #endif
  1791.   /*
  1792.    * The keyboard's special characters, those things that are prefixed with
  1793. !  * a 0x1F, are placed into the keyboard tables as KCTRL || 0x800 || x, for some
  1794. !  * x, i.e. they have both the control and 0x800 bits set, so they won't conflict
  1795.    * with anything else on the keyboard.
  1796.    */
  1797.   
  1798. ***************
  1799. *** 193,247 ****
  1800.       /*  KCTRL | 0xF3, NULL, "Sh-Print", */
  1801.       0, NULL, NULL
  1802.   };
  1803.   
  1804.   KEY_NAME_ARRAY  ibm_keys[] =
  1805.   {
  1806. !     KCTLX | 0x80 | 0x3B, MSG_display_bindings, "F1",
  1807. !         KCTLX | 0x80 | 0x3C, MSG_set_mark, "F2",
  1808. !         KCTLX | 0x80 | 0x3D, MSG_forw_search, "F3",
  1809. !         KCTLX | 0x80 | 0x3E, MSG_search_again, "F4",
  1810. !         KCTLX | 0x80 | 0x3F, MSG_query_replace, "F5",
  1811. !         KCTLX | 0x80 | 0x40, MSG_yank, "F6",
  1812. !         KCTLX | 0x80 | 0x41, MSG_copy_region, "F7",
  1813. !         KCTLX | 0x80 | 0x42, MSG_kill_region, "F8",
  1814. !         KCTLX | 0x80 | 0x43, MSG_goto_line, "F9",
  1815. !         KCTLX | 0x80 | 0x44, MSG_abort, "F10",
  1816. !         KCTLX | 0x80 | 0x54, MSG_help, "Sh-F1",
  1817. !         KCTLX | 0x80 | 0x55, MSG_file_read, "Sh-F2",
  1818. !         KCTLX | 0x80 | 0x56, MSG_file_save, "Sh-F3",
  1819. !         KCTLX | 0x80 | 0x57, MSG_file_visit, "Sh-F4",
  1820. !         KCTLX | 0x80 | 0x58, MSG_file_write, "Sh-F5",
  1821. !         KCTLX | 0x80 | 0x59, MSG_flush_all, "Sh-F6",
  1822. !         KCTLX | 0x80 | 0x5A, MSG_set_file_name, "Sh-F7",
  1823. !         KCTLX | 0x80 | 0x5B, MSG_file_insert, "Sh-F8",
  1824. !         KCTLX | 0x80 | 0x5C, MSG_exit_flush_all, "Sh-F9",
  1825. !         KCTLX | 0x80 | 0x5D, MSG_quit, "Sh-F10",
  1826. !         KCTLX | 0x80 | 0x5E, MSG_display_buffers, "Ctl-F1",
  1827. !         KCTLX | 0x80 | 0x5F, MSG_use_buffer, "Ctl-F2",
  1828. !         KCTLX | 0x80 | 0x60, MSG_kill_buffer, "Ctl-F3",
  1829. !         KCTLX | 0x80 | 0x61, MSG_next_buff, "Ctl-F4",
  1830. !         KCTLX | 0x80 | 0x62, MSG_prev_buff, "Ctl-F5",
  1831. !         KCTLX | 0x80 | 0x63, MSG_yank_buffer, "Ctl-F6",
  1832. !         KCTLX | 0x80 | 0x64, MSG_set_file_name, "Ctl-F7",
  1833. !         KCTLX | 0x80 | 0x65, MSG_file_insert, "Ctl-F8",
  1834. !         KCTLX | 0x80 | 0x66, MSG_exit_flush_all, "Ctl-F9",
  1835. !         KCTLX | 0x80 | 0x67, MSG_quit, "Ctl-F10",
  1836. !         KCTLX | 0x80 | 0x48, MSG_back_line, "North",
  1837. !         KCTLX | 0x80 | 0x4D, MSG_forw_char, "East",
  1838. !         KCTLX | 0x80 | 0x74, MSG_forw_unit, "Ctl-East",
  1839. !         KCTLX | 0x80 | 0x50, MSG_forw_line, "South",
  1840. !         KCTLX | 0x80 | 0x4B, MSG_back_char, "West",
  1841. !         KCTLX | 0x80 | 0x73, MSG_back_unit, "Ctl-West",
  1842. !         KCTLX | 0x80 | 0x49, MSG_back_page, "PageDown",
  1843. !         KCTLX | 0x80 | 0x47, MSG_goto_bob, "Home",
  1844. !         KCTLX | 0x80 | 0x51, MSG_forw_page, "PageUp",
  1845. !         KCTLX | 0x80 | 0x4F, MSG_goto_eob, "End",
  1846. !         KCTLX | 0x80 | 0x52, MSG_ins_toggle, "Insert",
  1847. !         KCTLX | 0x80 | 0x53, MSG_forw_del_char, "Delete",
  1848. !         KCTLX | 0x80 | 0x76, MSG_forw_window, "Ctl-PageDown",
  1849. !         KCTLX | 0x80 | 0x84, MSG_back_window, "Ctl-PageUp",
  1850. !         KCTLX | 0x80 | 0x72, MSG_print, "Ctl-Print",
  1851. !         KCTLX | 0x80 | 0x0F, MSG_forw_unit, "Sh-Tab",
  1852.           0, NULL, NULL
  1853.   };
  1854.   #endif
  1855. --- 193,335 ----
  1856.       /*  KCTRL | 0xF3, NULL, "Sh-Print", */
  1857.       0, NULL, NULL
  1858.   };
  1859. + #endif
  1860.   
  1861. + #if defined(MSDOS) || defined(OS2)
  1862.   KEY_NAME_ARRAY  ibm_keys[] =
  1863.   {
  1864. !             KCTLX | 0x800 | 0x3B, MSG_display_bindings, "F1",
  1865. !             KCTLX | 0x800 | 0x3C, MSG_set_mark,         "F2",
  1866. !             KCTLX | 0x800 | 0x3D, MSG_forw_search,      "F3",
  1867. !             KCTLX | 0x800 | 0x3E, MSG_search_again,     "F4",
  1868. !             KCTLX | 0x800 | 0x3F, MSG_query_replace,    "F5",
  1869. !             KCTLX | 0x800 | 0x40, MSG_yank,             "F6",
  1870. !             KCTLX | 0x800 | 0x41, MSG_copy_region,      "F7",
  1871. !             KCTLX | 0x800 | 0x42, MSG_kill_region,      "F8",
  1872. !             KCTLX | 0x800 | 0x43, MSG_goto_line,        "F9",
  1873. !             KCTLX | 0x800 | 0x44, NULL,                 "F10",
  1874. !             KCTLX | 0x800 | 0x85, NULL,                 "F11",
  1875. !             KCTLX | 0x800 | 0x86, NULL,                 "F12",
  1876. !             KCTLX | 0x800 | 0x54, MSG_help,             "Sh-F1",
  1877. !             KCTLX | 0x800 | 0x55, MSG_file_read,        "Sh-F2",
  1878. !             KCTLX | 0x800 | 0x56, MSG_file_save,        "Sh-F3",
  1879. !             KCTLX | 0x800 | 0x57, MSG_file_visit,       "Sh-F4",
  1880. !             KCTLX | 0x800 | 0x58, MSG_file_write,       "Sh-F5",
  1881. !             KCTLX | 0x800 | 0x59, MSG_flush_all,        "Sh-F6",
  1882. !             KCTLX | 0x800 | 0x5A, MSG_set_file_name,    "Sh-F7",
  1883. !             KCTLX | 0x800 | 0x5B, MSG_file_insert,      "Sh-F8",
  1884. !             KCTLX | 0x800 | 0x5C, MSG_exit_flush_all,   "Sh-F9",
  1885. !             KCTLX | 0x800 | 0x5D, MSG_quit,             "Sh-F10",
  1886. !             KCTLX | 0x800 | 0x87, NULL,                 "Sh-F11",
  1887. !             KCTLX | 0x800 | 0x88, NULL,                 "Sh-F12",
  1888. !             KCTLX | 0x800 | 0x5E, MSG_display_buffers,  "Ctl-F1",
  1889. !             KCTLX | 0x800 | 0x5F, MSG_use_buffer,       "Ctl-F2",
  1890. !             KCTLX | 0x800 | 0x60, MSG_kill_buffer,      "Ctl-F3",
  1891. !             KCTLX | 0x800 | 0x61, MSG_next_buff,        "Ctl-F4",
  1892. !             KCTLX | 0x800 | 0x62, MSG_prev_buff,        "Ctl-F5",
  1893. !             KCTLX | 0x800 | 0x63, MSG_yank_buffer,      "Ctl-F6",
  1894. !             KCTLX | 0x800 | 0x64, MSG_set_file_name,    "Ctl-F7",
  1895. !             KCTLX | 0x800 | 0x65, MSG_file_insert,      "Ctl-F8",
  1896. !             KCTLX | 0x800 | 0x66, MSG_exit_flush_all,   "Ctl-F9",
  1897. !             KCTLX | 0x800 | 0x67, MSG_quit,             "Ctl-F10",
  1898. !             KCTLX | 0x800 | 0x89, NULL,                 "Ctl-F11",
  1899. !             KCTLX | 0x800 | 0x8A, NULL,                 "Ctl-F12",
  1900. !             KCTLX | 0x800 | 0x68, NULL,                 "Alt-F1",
  1901. !             KCTLX | 0x800 | 0x69, NULL,                 "Alt-F2",
  1902. !             KCTLX | 0x800 | 0x6A, NULL,                 "Alt-F3",
  1903. !             KCTLX | 0x800 | 0x6B, NULL,                 "Alt-F4",
  1904. !             KCTLX | 0x800 | 0x6C, NULL,                 "Alt-F5",
  1905. !             KCTLX | 0x800 | 0x6D, NULL,                 "Alt-F6",
  1906. !             KCTLX | 0x800 | 0x6E, NULL,                 "Alt-F7",
  1907. !             KCTLX | 0x800 | 0x6F, NULL,                 "Alt-F8",
  1908. !             KCTLX | 0x800 | 0x70, NULL,                 "Alt-F9",
  1909. !             KCTLX | 0x800 | 0x71, NULL,                 "Alt-F10",
  1910. !             KCTLX | 0x800 | 0x8B, NULL,                 "Alt-F11",
  1911. !             KCTLX | 0x800 | 0x8C, NULL,                 "Alt-F12",
  1912. !             KCTLX | 0x800 | 0x48, MSG_back_line,        "North",
  1913. !             KCTLX | 0x800 | 0x4D, MSG_forw_char,        "East",
  1914. !             KCTLX | 0x800 | 0x50, MSG_forw_line,        "South",
  1915. !             KCTLX | 0x800 | 0x4B, MSG_back_char,        "West",
  1916. !             KCTLX | 0x800 | 0x8D, MSG_back_line,        "Ctl-North",
  1917. !             KCTLX | 0x800 | 0x74, MSG_forw_unit,        "Ctl-East",
  1918. !             KCTLX | 0x800 | 0x91, MSG_forw_line,        "Ctl-South",
  1919. !             KCTLX | 0x800 | 0x73, MSG_back_unit,        "Ctl-West",
  1920. !             KCTLX | 0x800 | 0x98, NULL,                 "Alt-North",
  1921. !             KCTLX | 0x800 | 0x9D, NULL,                 "Alt-East",
  1922. !             KCTLX | 0x800 | 0xA0, NULL,                 "Alt-South",
  1923. !             KCTLX | 0x800 | 0x9B, NULL,                 "Alt-West",
  1924. !             KCTLX | 0x800 | 0x49, MSG_back_page,        "PageDown",
  1925. !             KCTLX | 0x800 | 0x51, MSG_forw_page,        "PageUp",
  1926. !             KCTLX | 0x800 | 0x47, MSG_goto_bob,         "Home",
  1927. !             KCTLX | 0x800 | 0x4F, MSG_goto_eob,         "End",
  1928. !             KCTLX | 0x800 | 0x4C, NULL,                 "Center",
  1929. !             KCTLX | 0x800 | 0x76, MSG_forw_window,      "Ctl-PageDown",
  1930. !             KCTLX | 0x800 | 0x84, MSG_back_window,      "Ctl-PageUp",
  1931. !             KCTLX | 0x800 | 0x77, MSG_goto_bob,         "Ctl-Home",
  1932. !             KCTLX | 0x800 | 0x75, MSG_goto_eob,         "Ctl-End",
  1933. !             KCTLX | 0x800 | 0x8F, NULL,                 "Ctl-Center",
  1934. !             KCTLX | 0x800 | 0xA1, NULL,                 "Alt-PageDown",
  1935. !             KCTLX | 0x800 | 0x99, NULL,                 "Alt-PageUp",
  1936. !             KCTLX | 0x800 | 0x97, NULL,                 "Alt-Home",
  1937. !             KCTLX | 0x800 | 0x9F, NULL,                 "Alt-End",
  1938. !             KCTLX | 0x800 | 0x52, MSG_ins_toggle,       "Insert",
  1939. !             KCTLX | 0x800 | 0x53, MSG_forw_del_char,    "Delete",
  1940. !             KCTLX | 0x800 | 0x92, NULL,                 "Ctl-Insert",
  1941. !             KCTLX | 0x800 | 0x93, NULL,                 "Ctl-Delete",
  1942. !             KCTLX | 0x800 | 0xA2, NULL,                 "Alt-Insert",
  1943. !             KCTLX | 0x800 | 0xA3, NULL,                 "Alt-Delete",
  1944. !             KCTLX | 0x800 | 0x72, MSG_print,            "Ctl-Print",
  1945. !             KCTLX | 0x800 | 0x0F, NULL,                 "Sh-Tab",
  1946. !             KCTLX | 0x800 | 0x94, NULL,                 "Ctl-Tab",
  1947. !             KCTLX | 0x800 | 0xA5, NULL,                 "Alt-Tab",
  1948. !             KCTLX | 0x800 | 0x95, NULL,                 "Ctrl-Num/",
  1949. !             KCTLX | 0x800 | 0x96, NULL,                 "Ctrl-Num*",
  1950. !             KCTLX | 0x800 | 0x8E, NULL,                 "Ctrl-Num-",
  1951. !             KCTLX | 0x800 | 0x90, NULL,                 "Ctrl-Num+",
  1952. !             KCTLX | 0x800 | 0xA4, NULL,                 "Alt-Num/",
  1953. !             KCTLX | 0x800 | 0x37, NULL,                 "Alt-Num*",
  1954. !             KCTLX | 0x800 | 0x4A, NULL,                 "Alt-Num-",
  1955. !             KCTLX | 0x800 | 0x4E, NULL,                 "Alt-Num+",
  1956. !             KCTLX | 0x800 | 0xA6, NULL,                 "Alt-NumEnter",
  1957. !             KCTLX | 0x800 | 0x01, NULL,                 "Alt-Esc",
  1958. !             KCTLX | 0x800 | 0x1C, NULL,                 "Alt-Enter",
  1959. !             KCTLX | 0x800 | 0x0E, NULL,                 "Alt-Backspace",
  1960. !             KCTLX | 0x800 | 0x1E, NULL,                 "Alt-A",
  1961. !             KCTLX | 0x800 | 0x30, NULL,                 "Alt-B",
  1962. !             KCTLX | 0x800 | 0x2E, NULL,                 "Alt-C",
  1963. !             KCTLX | 0x800 | 0x20, NULL,                 "Alt-D",
  1964. !             KCTLX | 0x800 | 0x12, NULL,                 "Alt-E",
  1965. !             KCTLX | 0x800 | 0x21, NULL,                 "Alt-F",
  1966. !             KCTLX | 0x800 | 0x22, NULL,                 "Alt-G",
  1967. !             KCTLX | 0x800 | 0x23, NULL,                 "Alt-H",
  1968. !             KCTLX | 0x800 | 0x17, NULL,                 "Alt-I",
  1969. !             KCTLX | 0x800 | 0x24, NULL,                 "Alt-J",
  1970. !             KCTLX | 0x800 | 0x25, NULL,                 "Alt-K",
  1971. !             KCTLX | 0x800 | 0x26, NULL,                 "Alt-L",
  1972. !             KCTLX | 0x800 | 0x32, NULL,                 "Alt-M",
  1973. !             KCTLX | 0x800 | 0x31, NULL,                 "Alt-N",
  1974. !             KCTLX | 0x800 | 0x18, NULL,                 "Alt-O",
  1975. !             KCTLX | 0x800 | 0x19, NULL,                 "Alt-P",
  1976. !             KCTLX | 0x800 | 0x10, NULL,                 "Alt-Q",
  1977. !             KCTLX | 0x800 | 0x13, NULL,                 "Alt-R",
  1978. !             KCTLX | 0x800 | 0x1F, NULL,                 "Alt-S",
  1979. !             KCTLX | 0x800 | 0x14, NULL,                 "Alt-T",
  1980. !             KCTLX | 0x800 | 0x16, NULL,                 "Alt-U",
  1981. !             KCTLX | 0x800 | 0x2F, NULL,                 "Alt-V",
  1982. !             KCTLX | 0x800 | 0x11, NULL,                 "Alt-W",
  1983. !             KCTLX | 0x800 | 0x2D, NULL,                 "Alt-X",
  1984. !             KCTLX | 0x800 | 0x15, NULL,                 "Alt-Y",
  1985. !             KCTLX | 0x800 | 0x2C, NULL,                 "Alt-Z",
  1986. !             KCTLX | 0x800 | 0x78, NULL,                 "Alt-1",
  1987. !             KCTLX | 0x800 | 0x79, NULL,                 "Alt-2",
  1988. !             KCTLX | 0x800 | 0x7A, NULL,                 "Alt-3",
  1989. !             KCTLX | 0x800 | 0x7B, NULL,                 "Alt-4",
  1990. !             KCTLX | 0x800 | 0x7C, NULL,                 "Alt-5",
  1991. !             KCTLX | 0x800 | 0x7D, NULL,                 "Alt-6",
  1992. !             KCTLX | 0x800 | 0x7E, NULL,                 "Alt-7",
  1993. !             KCTLX | 0x800 | 0x7F, NULL,                 "Alt-8",
  1994. !             KCTLX | 0x800 | 0x80, NULL,                 "Alt-9",
  1995. !             KCTLX | 0x800 | 0x81, NULL,                 "Alt-0",
  1996.           0, NULL, NULL
  1997.   };
  1998.   #endif
  1999. ***************
  2000. *** 254,259 ****
  2001. --- 342,348 ----
  2002.    */
  2003.   static int  unkey = KRANDOM;    /* jam - for ungetkey */
  2004.   void ungetkey (k)
  2005. + int k;
  2006.   {
  2007.       unkey = k;
  2008.   }
  2009. ***************
  2010. *** 276,285 ****
  2011.               return (METACH);
  2012.           return (c | KCTRL);
  2013.       }
  2014. !     if (c == 0)
  2015.       {
  2016.           c = ttgetc ();
  2017. !         return (c | 0x80 | KCTLX);
  2018.       }
  2019.       return (c);
  2020.   }
  2021. --- 365,374 ----
  2022.               return (METACH);
  2023.           return (c | KCTRL);
  2024.       }
  2025. !     if (c == 0 || c == 0xE0)
  2026.       {
  2027.           c = ttgetc ();
  2028. !         return (c | 0x800 | KCTLX);
  2029.       }
  2030.       return (c);
  2031.   }
  2032. ***************
  2033. *** 294,300 ****
  2034.    */
  2035.   void ttykeymapinit ()
  2036.   {
  2037. ! #if MSDOS
  2038.       KEY_NAME_ARRAY  *ptr;
  2039.       int     i;
  2040.       char    buf[NCOL];
  2041. --- 383,389 ----
  2042.    */
  2043.   void ttykeymapinit ()
  2044.   {
  2045. ! #ifdef MSDOS
  2046.       KEY_NAME_ARRAY  *ptr;
  2047.       int     i;
  2048.       char    buf[NCOL];
  2049. ***************
  2050. *** 318,323 ****
  2051. --- 407,428 ----
  2052.       sprintf (buf, MSG_sp_key, i);
  2053.       writ_echo (buf);
  2054.   #endif
  2055. + #ifdef OS2
  2056. +     KEY_NAME_ARRAY  *ptr;
  2057. +     int     i;
  2058. +     char    buf[NCOL];
  2059. +         ptr = ibm_keys;
  2060. +         i = 0;
  2061. +         while (ptr -> key_code != 0)
  2062. +         {
  2063. +             if (ptr -> func_name_str != NULL)
  2064. +                 keydup (ptr -> key_code, ptr -> func_name_str);
  2065. +             ptr++;
  2066. +             i++;
  2067. +         }
  2068. +      /* sprintf (buf, MSG_sp_key, i);
  2069. +         writ_echo (buf); */
  2070. + #endif
  2071.   }
  2072.   /*
  2073.   *   Search key name array for given key code.
  2074. ***************
  2075. *** 326,332 ****
  2076.   char    *keystrings (key)
  2077.   int     key;
  2078.   {
  2079. ! #if MSDOS
  2080.       KEY_NAME_ARRAY  *ptr;
  2081.   
  2082.       if (wang_pc)
  2083. --- 431,437 ----
  2084.   char    *keystrings (key)
  2085.   int     key;
  2086.   {
  2087. ! #ifdef MSDOS
  2088.       KEY_NAME_ARRAY  *ptr;
  2089.   
  2090.       if (wang_pc)
  2091. ***************
  2092. *** 337,342 ****
  2093. --- 442,459 ----
  2094.   
  2095.       if (!wang_pc && !ibm_pc)
  2096.           return(NULL);
  2097. +     while (ptr -> key_code != 0)
  2098. +         {
  2099. +         if (key == ptr -> key_code)
  2100. +             {
  2101. +             return (ptr -> key_name_str);
  2102. +             }
  2103. +         ptr++;
  2104. +         }
  2105. + #endif
  2106. + #ifdef OS2
  2107. +     KEY_NAME_ARRAY  *ptr = ibm_keys;
  2108.   
  2109.       while (ptr -> key_code != 0)
  2110.       {
  2111. diff -cb orig/window.c new/window.c
  2112. *** orig/window.c    Fri Nov 22 19:03:24 1991
  2113. --- new/window.c    Mon Jan 06 15:30:14 1992
  2114. ***************
  2115. *** 81,87 ****
  2116.   * to "move up".
  2117.   */
  2118.   bool    mvdnwind (f, n, k)
  2119. ! register int    n;
  2120.   {
  2121.       return (mvupwind (f, -n, KRANDOM));
  2122.   }
  2123. --- 81,87 ----
  2124.   * to "move up".
  2125.   */
  2126.   bool    mvdnwind (f, n, k)
  2127. ! register int    f, n, k;
  2128.   {
  2129.       return (mvupwind (f, -n, KRANDOM));
  2130.   }
  2131. ***************
  2132. *** 96,102 ****
  2133.   * not really move "."; it moves the frame).
  2134.   */
  2135.   bool    mvupwind (f, n, k)
  2136. ! int    n;
  2137.   {
  2138.       A32   l_val, l_bytes;
  2139.   
  2140. --- 96,102 ----
  2141.   * not really move "."; it moves the frame).
  2142.   */
  2143.   bool    mvupwind (f, n, k)
  2144. ! int     f, n, k;
  2145.   {
  2146.       A32   l_val, l_bytes;
  2147.   
  2148. ***************
  2149. *** 331,336 ****
  2150. --- 331,337 ----
  2151.   * because dot would move.
  2152.   */
  2153.   bool enlargewind (f, n, k)
  2154. + int f, n, k;
  2155.   {
  2156.       register    WINDOW * adjwp;
  2157.       register    LINE * lp;
  2158. ***************
  2159. *** 392,397 ****
  2160. --- 393,399 ----
  2161.   * do all the hard work.
  2162.   */
  2163.   bool shrinkwind (f, n, k)
  2164. + int f, n, k;
  2165.   {
  2166.       register    WINDOW * adjwp;
  2167.       register    LINE * lp;
  2168. diff -cb orig/word.c new/word.c
  2169. *** orig/word.c    Fri Nov 22 19:03:26 1991
  2170. --- new/word.c    Mon Jan 06 15:30:16 1992
  2171. ***************
  2172. *** 20,25 ****
  2173. --- 20,26 ----
  2174.   * the buffers.
  2175.   */
  2176.   char    backunit (f, n, k)
  2177. + int f, n, k;
  2178.   {
  2179.       char    ret;
  2180.   
  2181. ***************
  2182. *** 44,49 ****
  2183. --- 45,51 ----
  2184.   * try and move beyond the buffer's end.
  2185.   */
  2186.   char    forwunit (f, n, k)
  2187. + int f, n, k;
  2188.   {
  2189.   
  2190.       if      (n < 0)
  2191. ***************
  2192. *** 68,73 ****
  2193. --- 70,76 ----
  2194.   * way when it hits the end of the buffer.
  2195.   */
  2196.   bool delfunit (f, n, k)
  2197. + int f, n, k;
  2198.   {
  2199.       if (n < 0)
  2200.           return (FALSE);
  2201. ***************
  2202. *** 97,102 ****
  2203. --- 100,106 ----
  2204.   * to "M-Backspace".
  2205.   */
  2206.   bool delbunit (f, n, k)
  2207. + int f, n, k;
  2208.   {
  2209.       int size;
  2210.   
  2211.  
  2212.