home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / UE3112.ZIP / patches < prev    next >
Text File  |  1991-12-22  |  66KB  |  2,533 lines

  1. diff -cbr src-orig/basic.c src/basic.c
  2. *** src-orig/basic.c    Mon Dec 16 11:42:16 1991
  3. --- src/basic.c    Sun Dec 22 16:19:00 1991
  4. ***************
  5. *** 164,169 ****
  6. --- 164,207 ----
  7.           return(TRUE);
  8.   }
  9.   
  10. + #if   KEEPPOS
  11. + /*
  12. +  * Move to the top of the screen.  The standsrd screen code does most of the
  13. +  * hard parts of update.
  14. +  *
  15. +  */
  16. + PASCAL NEAR gotobos(f, n)
  17. + int f, n;
  18. + {
  19. +         curwp->w_dotp  = curwp->w_linep;
  20. +         curwp->w_doto  = 0;
  21. +         curwp->w_flag |= WFHARD;
  22. +         return(TRUE);
  23. + } /* gotobos */
  24. + /*
  25. +  * Goto the end of the screen.
  26. +  */
  27. + PASCAL NEAR gotoeos(f, n)
  28. + int f, n;
  29. + {
  30. + register LINE   *lp;
  31. + int   currow;
  32. +       lp = curwp->w_linep;
  33. +       currow = curwp->w_ntrows - 1;
  34. +         while (currow-- && lp!=curbp->b_linep) lp = lforw(lp);
  35. +         curwp->w_dotp  = lp;
  36. +         curwp->w_doto  = 0;
  37. +         curwp->w_flag |= WFHARD;
  38. +         return(TRUE);
  39. + } /* gotoeos */
  40. + #endif
  41.   /*
  42.    * Move forward by full lines. If the number of lines to move is less than
  43.    * zero, call the backward line function to actually do it. The last command
  44. ***************
  45. *** 440,445 ****
  46. --- 478,488 ----
  47.   {
  48.           register LINE   *lp;
  49.   
  50. + #if   KEEPPOS
  51. +         int     currow;
  52. +         register LINE   *lp1;
  53. + #endif
  54.           if (f == FALSE) {
  55.                   n = curwp->w_ntrows - 2;        /* Default scroll.      */
  56.                   if (n <= 0)                     /* Forget the overlap   */
  57. ***************
  58. *** 447,457 ****
  59.           } else if (n < 0)
  60.                   return(backpage(f, -n));
  61.           lp = curwp->w_linep;
  62.           while (n-- && lp!=curbp->b_linep)
  63.                   lp = lforw(lp);
  64.           curwp->w_linep = lp;
  65. !         curwp->w_dotp  = lp;
  66.           curwp->w_doto  = 0;
  67.           curwp->w_flag |= WFHARD;
  68.           return(TRUE);
  69.   }
  70. --- 490,521 ----
  71.           } else if (n < 0)
  72.                   return(backpage(f, -n));
  73.           lp = curwp->w_linep;
  74. + #if   KEEPPOS
  75. +         if ((lastflag&CFCPCN) == 0)
  76. +                 curgoal = getccol(FALSE);
  77. +         /* flag this command as a line move */
  78. +         thisflag |= CFCPCN;
  79. +         lp1 = lp;
  80. +         currow = 0;
  81. +         while (lp1 != curwp->w_dotp ) {
  82. +               currow++;
  83. +               lp1 = lforw(lp1);
  84. +         }
  85. + #endif
  86.           while (n-- && lp!=curbp->b_linep)
  87.                   lp = lforw(lp);
  88.           curwp->w_linep = lp;
  89. ! #if   KEEPPOS
  90. !         while (currow-- && lp!=curbp->b_linep) lp = lforw(lp);
  91. !         curwp->w_doto = getgoal(lp);
  92. ! #else
  93.           curwp->w_doto  = 0;
  94. + #endif
  95. +         curwp->w_dotp  = lp;
  96.           curwp->w_flag |= WFHARD;
  97.           return(TRUE);
  98.   }
  99. ***************
  100. *** 470,475 ****
  101. --- 534,544 ----
  102.   {
  103.           register LINE   *lp;
  104.   
  105. + #if   KEEPPOS
  106. +         int     currow;
  107. +         register LINE   *lp1;
  108. + #endif
  109.           if (f == FALSE) {
  110.                   n = curwp->w_ntrows - 2;        /* Default scroll.      */
  111.                   if (n <= 0)                     /* Don't blow up if the */
  112. ***************
  113. *** 477,487 ****
  114.           } else if (n < 0)
  115.                   return(forwpage(f, -n));
  116.           lp = curwp->w_linep;
  117.           while (n-- && lback(lp)!=curbp->b_linep)
  118.                   lp = lback(lp);
  119.           curwp->w_linep = lp;
  120. !         curwp->w_dotp  = lp;
  121.           curwp->w_doto  = 0;
  122.           curwp->w_flag |= WFHARD;
  123.           return(TRUE);
  124.   }
  125. --- 546,577 ----
  126.           } else if (n < 0)
  127.                   return(forwpage(f, -n));
  128.           lp = curwp->w_linep;
  129. + #if   KEEPPOS
  130. +         if ((lastflag&CFCPCN) == 0)
  131. +                 curgoal = getccol(FALSE);
  132. +         /* flag this command as a line move */
  133. +         thisflag |= CFCPCN;
  134. +         lp1 = lp;
  135. +         currow = 0;
  136. +         while (lp1 != curwp->w_dotp ) {
  137. +               currow++;
  138. +               lp1 = lforw(lp1);
  139. +         }
  140. + #endif
  141.           while (n-- && lback(lp)!=curbp->b_linep)
  142.                   lp = lback(lp);
  143.           curwp->w_linep = lp;
  144. ! #if   KEEPPOS
  145. !         while (currow-- && lp!=curbp->b_linep) lp = lforw(lp);
  146. !         curwp->w_doto = getgoal(lp);
  147. ! #else
  148.           curwp->w_doto  = 0;
  149. + #endif
  150. +         curwp->w_dotp  = lp;
  151.           curwp->w_flag |= WFHARD;
  152.           return(TRUE);
  153.   }
  154. diff -cbr src-orig/bind.c src/bind.c
  155. *** src-orig/bind.c    Mon Dec 16 11:42:16 1991
  156. --- src/bind.c    Sun Dec 22 16:19:00 1991
  157. ***************
  158. *** 772,777 ****
  159. --- 772,782 ----
  160.   
  161.       c = c & 255;    /* strip the prefixes */
  162.   
  163. +         if ((c & 255) == 127) {
  164. +                 *ptr++ = '^';
  165. +                 c = '?';
  166. +         }
  167.       /* and output the final sequence */
  168.   
  169.       *ptr++ = c;
  170. ***************
  171. *** 938,944 ****
  172.       if (*keyname == '^' && *(keyname+1) != 0) {
  173.           c |= CTRL;
  174.           ++keyname;
  175. !         uppercase(keyname);
  176.       }
  177.   
  178.       /* A literal control character? (Boo, hiss) */
  179. --- 943,949 ----
  180.       if (*keyname == '^' && *(keyname+1) != 0) {
  181.           c |= CTRL;
  182.           ++keyname;
  183. !         /* uppercase(keyname); */
  184.       }
  185.   
  186.       /* A literal control character? (Boo, hiss) */
  187. diff -cbr src-orig/char.c src/char.c
  188. *** src-orig/char.c    Mon Dec 16 11:42:16 1991
  189. --- src/char.c    Sun Dec 22 16:19:00 1991
  190. ***************
  191. *** 139,145 ****
  192.           upcase[index ^ DIFCASE] = index;
  193.       }
  194.   
  195. ! #if    MSDOS
  196.       /* setup various extended IBM-PC characters */
  197.       upcase[0x80]  = 0x87;    /* C with a cedilla */
  198.       lowcase[0x81] = 0x9a;    /* U with an umlaut */
  199. --- 139,145 ----
  200.           upcase[index ^ DIFCASE] = index;
  201.       }
  202.   
  203. ! #if     MSDOS | OS2
  204.       /* setup various extended IBM-PC characters */
  205.       upcase[0x80]  = 0x87;    /* C with a cedilla */
  206.       lowcase[0x81] = 0x9a;    /* U with an umlaut */
  207. diff -cbr src-orig/display.c src/display.c
  208. *** src-orig/display.c    Mon Dec 16 11:42:16 1991
  209. --- src/display.c    Sun Dec 22 16:19:02 1991
  210. ***************
  211. *** 885,891 ****
  212. --- 885,897 ----
  213.           || req || rev
  214.   #endif
  215.               ) {
  216. + #if     OS2NPM
  217. +             ttrow = row;  /* special optimization */
  218. +                 ttcol = 0;
  219. +                 os2vmove(row, 0);       /* Go to start of line. */
  220. + #else
  221.           movecursor(row, 0);    /* Go to start of line. */
  222. + #endif
  223.           /* set rev video if needed */
  224.           if (rev != req)
  225.               (*term.t_rev)(req);
  226. ***************
  227. *** 979,985 ****
  228. --- 985,997 ----
  229.       }
  230.   
  231.       /* move to the begining of the text to update */
  232. + #if     OS2NPM
  233. +         ttrow = row;  /* special optimization */
  234. +         ttcol = upcol;
  235. +         os2vmove(row, upcol);       /* Go to start of line. */
  236. + #else
  237.       movecursor(row, upcol);
  238. + #endif
  239.   
  240.   #if    REVSTA
  241.       if (rev)
  242. diff -cbr src-orig/dolock.c src/dolock.c
  243. *** src-orig/dolock.c    Mon Dec 16 11:42:16 1991
  244. --- src/dolock.c    Sun Dec 22 16:19:02 1991
  245. ***************
  246. *** 71,79 ****
  247. --- 71,81 ----
  248.   #if    ZTC
  249.   extern volatile int errno;
  250.   #else
  251. + #if     MSC == 0
  252.   extern int errno;
  253.   #endif
  254.   #endif
  255. + #endif
  256.   
  257.   #define LOCKDIR "_xlk"
  258.   #define LOCKMSG "LOCK ERROR -- "
  259. diff -cbr src-orig/edef.h src/edef.h
  260. *** src-orig/edef.h    Mon Dec 16 11:44:30 1991
  261. --- src/edef.h    Sun Dec 22 16:19:22 1991
  262. ***************
  263. *** 27,33 ****
  264.   NOSHARE int DNEAR eolexist = TRUE;    /* does clear to EOL exist?    */
  265.   NOSHARE int DNEAR revexist = FALSE;    /* does reverse video exist?    */
  266.   NOSHARE int DNEAR exec_error = FALSE;    /* macro execution error pending? */
  267. ! NOSHARE int DNEAR flickcode = TRUE;    /* do flicker supression?    */
  268.   CONST char *modename[] = {         /* name of modes        */
  269.       "WRAP", "CMODE", "SPELL", "EXACT", "VIEW", "OVER",
  270.       "MAGIC", "CRYPT", "ASAVE", "REP"};
  271. --- 27,33 ----
  272.   NOSHARE int DNEAR eolexist = TRUE;    /* does clear to EOL exist?    */
  273.   NOSHARE int DNEAR revexist = FALSE;    /* does reverse video exist?    */
  274.   NOSHARE int DNEAR exec_error = FALSE;    /* macro execution error pending? */
  275. ! NOSHARE int DNEAR flickcode = FALSE;    /* do flicker supression?    */
  276.   CONST char *modename[] = {         /* name of modes        */
  277.       "WRAP", "CMODE", "SPELL", "EXACT", "VIEW", "OVER",
  278.       "MAGIC", "CRYPT", "ASAVE", "REP"};
  279. ***************
  280. *** 93,98 ****
  281. --- 93,101 ----
  282.   NOSHARE int DNEAR kbdmode = STOP;    /* current keyboard macro mode    */
  283.   NOSHARE int DNEAR kbdrep = 0;        /* number of repetitions    */
  284.   NOSHARE int DNEAR restflag = FALSE;    /* restricted use?        */
  285. + #ifdef    BACKUP
  286. + NOSHARE    int DNEAR bakfile = TRUE;    /* save the bakfile        */
  287. + #endif
  288.   NOSHARE int DNEAR lastkey = 0;        /* last keystoke        */
  289.   NOSHARE int DNEAR seed = 0;        /* random number seed        */
  290.   NOSHARE long envram = 0l;        /* # of bytes current in use by malloc */
  291. ***************
  292. *** 277,282 ****
  293. --- 280,288 ----
  294.   NOSHARE extern int kbdmode;        /* current keyboard macro mode    */
  295.   NOSHARE extern int kbdrep;        /* number of repetitions    */
  296.   NOSHARE extern int restflag;        /* restricted use?        */
  297. + #ifdef    BACKUP
  298. + NOSHARE    extern    int bakfile;        /* save the bakfile        */
  299. + #endif
  300.   NOSHARE extern int lastkey;        /* last keystoke        */
  301.   NOSHARE extern int seed;        /* random number seed        */
  302.   NOSHARE extern long envram;        /* # of bytes current in use by malloc */
  303. diff -cbr src-orig/efunc.h src/efunc.h
  304. *** src-orig/efunc.h    Mon Dec 16 11:44:30 1991
  305. --- src/efunc.h    Sun Dec 22 16:19:22 1991
  306. ***************
  307. *** 27,32 ****
  308. --- 27,35 ----
  309.       {"begin-macro",            ctlxlp},
  310.       {"beginning-of-file",        gotobob},
  311.       {"beginning-of-line",        gotobol},
  312. + #if    KEEPPOS
  313. +     {"beginning-of-screen",        gotobos},
  314. + #endif
  315.       {"bind-to-key",            bindtokey},
  316.       {"buffer-position",        showcpos},
  317.       {"case-region-lower",        lowerregion},
  318. ***************
  319. *** 39,44 ****
  320. --- 42,50 ----
  321.       {"change-screen-row",        new_row_org},
  322.       {"change-screen-size",        newsize},
  323.       {"change-screen-width",        newwidth},
  324. + #if    CHDIR
  325. +     {"change-working-directory",    changedir},
  326. + #endif
  327.       {"clear-and-redraw",        refresh},
  328.       {"clear-message-line",        clrmes},
  329.       {"copy-region",            copyregion},
  330. ***************
  331. *** 48,53 ****
  332. --- 54,60 ----
  333.       {"delete-blank-lines",        deblank},
  334.       {"delete-buffer",        killbuffer},
  335.       {"delete-global-mode",        delgmode},
  336. +     {"delete-line",            delline},
  337.       {"delete-mode",            delmode},
  338.       {"delete-next-character",    forwdel},
  339.       {"delete-next-word",        delfword},
  340. ***************
  341. *** 72,77 ****
  342. --- 79,87 ----
  343.       {"end-macro",            ctlxrp},
  344.       {"end-of-file",            gotoeob},
  345.       {"end-of-line",            gotoeol},
  346. + #ifdef    KEEPPOS
  347. +     {"end-of-screen",        gotoeos},
  348. + #endif
  349.       {"end-of-word",            endword},
  350.       {"entab-line",            entab},
  351.       {"entab-region",        entab},
  352. ***************
  353. *** 227,232 ****
  354. --- 237,243 ----
  355.   #if    CTAGS
  356.       {"tag-word",            tagword},
  357.   #endif
  358. +     {"toggle-over-mode",        toggleovermode},
  359.       {"transpose-characters",    twiddle},
  360.       {"trim-line",            trim},
  361.       {"trim-region",            trim},
  362. diff -cbr src-orig/epath.h src/epath.h
  363. *** src-orig/epath.h    Mon Dec 16 11:44:30 1991
  364. --- src/epath.h    Sun Dec 22 16:19:24 1991
  365. ***************
  366. *** 44,54 ****
  367.   
  368.   #if    MSDOS
  369.   {
  370. !     "emacs.rc",
  371. !     "emacs.hlp",
  372. !     "\\sys\\public\\",
  373. !     "\\usr\\bin\\",
  374. !     "\\bin\\",
  375.       "\\",
  376.       ""
  377.   };
  378. --- 44,54 ----
  379.   
  380.   #if    MSDOS
  381.   {
  382. !     "me.rc",
  383. !     "me.hlp",
  384. !      "c:\\bin\\",
  385. !         "c:\\etc\\",
  386. !     "c:\\",
  387.       "\\",
  388.       ""
  389.   };
  390. ***************
  391. *** 56,67 ****
  392.   
  393.   #if OS2
  394.   {
  395. !         "emacs.rc",
  396. !         "emacs.hlp",
  397. !         "C:\\OS2\\SYSTEM\\",
  398. !         "C:\\OS2\\DLL\\",
  399. !         "C:\\OS2\\BIN\\",
  400. !         "C:\\OS2\\",
  401.           "\\",
  402.           ""
  403.   };
  404. --- 56,67 ----
  405.   
  406.   #if OS2
  407.   {
  408. !         "me.rc",
  409. !         "me.hlp",
  410. !      "c:\\bin\\",
  411. !         "c:\\etc\\",
  412. !         "c:\\os2\\",
  413. !     "c:\\",
  414.           "\\",
  415.           ""
  416.   };
  417. ***************
  418. *** 71,78 ****
  419.   {
  420.       ".emacsrc",
  421.       "emacs.hlp",
  422. -     "/usr/local/",
  423.       "/usr/lib/",
  424.       ""
  425.   };
  426.   #endif
  427. --- 71,80 ----
  428.   {
  429.       ".emacsrc",
  430.       "emacs.hlp",
  431.       "/usr/lib/",
  432. +     "/usr/local/",
  433. +     "/usr/local/lib/",
  434. +     "/usr/local/lib/emacs/",
  435.       ""
  436.   };
  437.   #endif
  438. diff -cbr src-orig/eproto.h src/eproto.h
  439. *** src-orig/eproto.h    Mon Dec 16 11:44:30 1991
  440. --- src/eproto.h    Sun Dec 22 16:19:26 1991
  441. ***************
  442. *** 284,289 ****
  443. --- 284,290 ----
  444.   extern PASCAL NEAR forwpage(int f, int n);
  445.   extern PASCAL NEAR forwword(int f, int n);
  446.   extern PASCAL NEAR freewhile(WHBLOCK *wp);
  447. + extern PASCAL NEAR getbackupname(char *backup, char *file);
  448.   extern PASCAL NEAR getccol(int bflg);
  449.   extern PASCAL NEAR getcmd(void);
  450.   extern PASCAL NEAR getfence(int f, int n);
  451. ***************
  452. *** 336,341 ****
  453. --- 337,343 ----
  454.   extern PASCAL NEAR lowrite(char c);
  455.   extern PASCAL NEAR macarg(char *tok);
  456.   extern PASCAL NEAR macrotokey(int f, int n);
  457. + extern PASCAL NEAR makebackup(char *filename);
  458.   extern PASCAL NEAR makelist(int iflag);
  459.   extern PASCAL NEAR mouse_screen(void);
  460.   extern PASCAL NEAR screenlist(int iflag);
  461. ***************
  462. *** 488,501 ****
  463.   extern int PASCAL NEAR backtagword(int f, int n); /* return from tagged word */
  464.   #endif
  465.   
  466.   /* some library redefinitions */
  467.   
  468.   char *strcat(char *, char *);
  469.   char *strcpy(char *, char *);
  470.   #if RAMSIZE == 0
  471. ! char *malloc(int);
  472.   #endif
  473. ! char *realloc(char *block, int siz);
  474.   
  475.   #else
  476.   
  477. --- 490,515 ----
  478.   extern int PASCAL NEAR backtagword(int f, int n); /* return from tagged word */
  479.   #endif
  480.   
  481. + extern PASCAL    NEAR    toggleovermode(int f, int n);
  482. + extern PASCAL    NEAR    delline(int f, int n);
  483. +   
  484. + #if    KEEPPOS
  485. + extern PASCAL NEAR    gotobos(int f, int n);    /* goto beginning of screen */
  486. + extern PASCAL NEAR    gotoeos(int f, int n);    /* goto end of screen */
  487. + #endif
  488. + #if    CHDIR
  489. + extern PASCAL NEAR changedir(int f, int n);
  490. + #endif
  491.   /* some library redefinitions */
  492.   
  493.   char *strcat(char *, char *);
  494.   char *strcpy(char *, char *);
  495.   #if RAMSIZE == 0
  496. ! void *malloc(size_t);
  497.   #endif
  498. ! void *realloc(void *block, size_t siz);
  499.   
  500.   #else
  501.   
  502. ***************
  503. *** 766,771 ****
  504. --- 780,786 ----
  505.   extern PASCAL NEAR forwpage();
  506.   extern PASCAL NEAR forwword();
  507.   extern PASCAL NEAR freewhile();
  508. + extern PASCAL NEAR getbackupname();
  509.   extern PASCAL NEAR getccol();
  510.   extern PASCAL NEAR getcmd();
  511.   extern PASCAL NEAR getfence();
  512. ***************
  513. *** 819,824 ****
  514. --- 834,840 ----
  515.   extern PASCAL NEAR lowrite();
  516.   extern PASCAL NEAR macarg();
  517.   extern PASCAL NEAR macrotokey();
  518. + extern PASCAL NEAR makebackup();
  519.   extern PASCAL NEAR makelist();
  520.   extern PASCAL NEAR mouse_screen();
  521.   extern PASCAL NEAR screenlist();
  522. ***************
  523. *** 969,974 ****
  524. --- 985,1002 ----
  525.   extern int PASCAL NEAR tagword();    /* vi-like tagging */
  526.   extern int PASCAL NEAR retagword();    /* Try again (if redefined) */
  527.   extern int PASCAL NEAR backtagword();    /* return from tagged word */
  528. + #endif
  529. + extern PASCAL    NEAR    toggleovermode();
  530. + extern PASCAL    NEAR    delline();
  531. +   
  532. + #if    KEEPPOS
  533. + extern PASCAL NEAR    gotobos();        /* goto beginning of screen */
  534. + extern PASCAL NEAR    gotoeos();        /* goto end of screen */
  535. + #endif
  536. + #if    CHDIR
  537. + extern PASCAL NEAR changedir();
  538.   #endif
  539.   
  540.   /* some library redefinitions */
  541. diff -cbr src-orig/estruct.h src/estruct.h
  542. *** src-orig/estruct.h    Mon Dec 16 11:44:32 1991
  543. --- src/estruct.h    Sun Dec 22 14:42:36 1991
  544. ***************
  545. *** 146,162 ****
  546.   #define REVSTA    1    /* Status line appears in reverse video     */
  547.   #define    COLOR    1    /* color commands and windows            */
  548.   
  549. ! #define FILOCK    1    /* file locking under unix BSD 4.2        */
  550.   #define    ISRCH    1    /* Incremental searches like ITS EMACS        */
  551. ! #define    FLABEL    1    /* function key label code [HP150]        */
  552.   #define    CRYPT    1    /* file encryption enabled?            */
  553.   #define MAGIC    1    /* include regular expression matching?        */
  554.   #define MOUSE    1     /* Include routines for mouse actions        */
  555.   #define    NOISY    1    /* Use a fancy BELL if it exists        */
  556. ! #define CTAGS    0    /* include vi-like tagging?            */
  557.   #define    SPEECH    0    /* spoken EMACS, for the sight impared [not ready] */
  558.   #define    VARARG    1    /* use varargs.h for mlwrite()            */
  559.   
  560.   /*    Character set options        */
  561.   /*    [Set one of these!!]        */
  562.   #define ASCII    1    /* always using ASCII char sequences for now    */
  563. --- 146,167 ----
  564.   #define REVSTA    1    /* Status line appears in reverse video     */
  565.   #define    COLOR    1    /* color commands and windows            */
  566.   
  567. ! #define FILOCK    0    /* file locking under unix BSD 4.2        */
  568.   #define    ISRCH    1    /* Incremental searches like ITS EMACS        */
  569. ! #define    FLABEL    0    /* function key label code [HP150]        */
  570.   #define    CRYPT    1    /* file encryption enabled?            */
  571.   #define MAGIC    1    /* include regular expression matching?        */
  572.   #define MOUSE    1     /* Include routines for mouse actions        */
  573.   #define    NOISY    1    /* Use a fancy BELL if it exists        */
  574. ! #define CTAGS    1    /* include vi-like tagging?            */
  575.   #define    SPEECH    0    /* spoken EMACS, for the sight impared [not ready] */
  576.   #define    VARARG    1    /* use varargs.h for mlwrite()            */
  577.   
  578. + #define BACKUP    0    /* retain original file as backup (MSDOS, UNIX) */
  579. + #define    SOFTAB    1    /* in OVER mode, are tabs and returns soft?    */
  580. + #define    KEEPPOS    1    /* Maintain cursor position when paging        */
  581. + #define CHDIR   1    /* code for changing working directory        */
  582.   /*    Character set options        */
  583.   /*    [Set one of these!!]        */
  584.   #define ASCII    1    /* always using ASCII char sequences for now    */
  585. ***************
  586. *** 222,228 ****
  587.   #if MSDOS & (TURBO | MSC | TIPC)
  588.   #define    NEAR
  589.   #define    DNEAR
  590. ! #define    PASCAL pascal
  591.   #define    CDECL cdecl
  592.   #else
  593.   #if MSDOS & ZTC
  594. --- 227,233 ----
  595.   #if MSDOS & (TURBO | MSC | TIPC)
  596.   #define    NEAR
  597.   #define    DNEAR
  598. ! #define    PASCAL /* pascal */
  599.   #define    CDECL cdecl
  600.   #else
  601.   #if MSDOS & ZTC
  602. ***************
  603. *** 397,403 ****
  604.   /*    internal constants    */
  605.   
  606.   #define NBINDS    300            /* max # of bound keys        */
  607. ! #if    AOSVS | VMS
  608.   #define    NFILEN    256
  609.   #else
  610.   #define NFILEN    80            /* # of bytes, file name    */
  611. --- 402,408 ----
  612.   /*    internal constants    */
  613.   
  614.   #define NBINDS    300            /* max # of bound keys        */
  615. ! #if    AOSVS | VMS | OS2
  616.   #define    NFILEN    256
  617.   #else
  618.   #define NFILEN    80            /* # of bytes, file name    */
  619. ***************
  620. *** 655,660 ****
  621. --- 660,668 ----
  622.       char    b_bname[NBUFN];     /* Buffer name            */
  623.   #if    CRYPT
  624.       char   b_key[NPAT];           /* current encrypted key        */
  625. + #endif
  626. + #if    BACKUP                               /* -- ZU */
  627. +     short    b_bupflg;        /* true if file was backed up    */
  628.   #endif
  629.   }    BUFFER;
  630.   
  631. diff -cbr src-orig/file.c src/file.c
  632. *** src-orig/file.c    Mon Dec 16 11:42:18 1991
  633. --- src/file.c    Sun Dec 22 16:37:44 1991
  634. ***************
  635. *** 11,18 ****
  636.   #include    "eproto.h"
  637.   #include    "edef.h"
  638.   #include    "elang.h"
  639. ! #if    BSD | SUN | V7
  640.   #include    <sys/types.h>
  641.   #include    <sys/stat.h>
  642.   #endif
  643.   
  644. --- 11,19 ----
  645.   #include    "eproto.h"
  646.   #include    "edef.h"
  647.   #include    "elang.h"
  648. ! #if     V7 | USG | HPUX | BSD | SUN | XENIX | MSDOS | OS2
  649.   #include    <sys/types.h>
  650. + #undef CDECL
  651.   #include    <sys/stat.h>
  652.   #endif
  653.   
  654. ***************
  655. *** 176,182 ****
  656.       register int cmark;    /* current mark */
  657.       char bname[NBUFN];    /* buffer name to put file */
  658.   
  659. ! #if    MSDOS | OS2 | AOSVS | VMS | TOS
  660.       mklower(fname);            /* msdos isn't case sensitive */
  661.   #endif
  662.       for (bp=bheadp; bp!=NULL; bp=bp->b_bufp) {
  663. --- 177,183 ----
  664.       register int cmark;    /* current mark */
  665.       char bname[NBUFN];    /* buffer name to put file */
  666.   
  667. ! #if    MSDOS | _OS2 | AOSVS | VMS | TOS
  668.       mklower(fname);            /* msdos isn't case sensitive */
  669.   #endif
  670.       for (bp=bheadp; bp!=NULL; bp=bp->b_bufp) {
  671. ***************
  672. *** 262,267 ****
  673. --- 263,271 ----
  674.       if ((s=bclear(bp)) != TRUE)        /* Might be old.    */
  675.           return(s);
  676.       bp->b_flag &= ~(BFINVS|BFCHG);
  677. + #if    BACKUP
  678. +     curbp->b_bupflg = FALSE;        /* no backup file yet    */
  679. + #endif
  680.       strcpy(bp->b_fname, fname);
  681.   
  682.       /* let a user macro get hold of things...if he wants */
  683. ***************
  684. *** 465,470 ****
  685. --- 469,477 ----
  686.       if ((s=writeout(fname, "w")) == TRUE) {
  687.           strcpy(curbp->b_fname, fname);
  688.           curbp->b_flag &= ~BFCHG;
  689. + #if    BACKUP
  690. +         curbp->b_bupflg = TRUE;
  691. + #endif
  692.           /* Update mode lines.    */
  693.           upmode();
  694.       }
  695. ***************
  696. *** 486,491 ****
  697. --- 493,501 ----
  698.           return(s);
  699.       if ((s=writeout(fname, "a")) == TRUE) {
  700.           curbp->b_flag &= ~BFCHG;
  701. + #if    BACKUP
  702. +         curbp->b_bupflg = TRUE;
  703. + #endif
  704.           /* Update mode lines.    */
  705.           upmode();
  706.       }
  707. ***************
  708. *** 549,555 ****
  709.    * This function performs the details of file writing. It uses
  710.    * the file management routines in the "fileio.c" package. The
  711.    * number of lines written is displayed. Several errors are
  712. !  * posible, and cause writeout to return a FALSE result. When
  713.    * $ssave is TRUE,  the buffer is written out to a temporary
  714.    * file, and then the old file is unlinked and the temporary
  715.    * renamed to the original name.  Before the file is written,
  716. --- 559,565 ----
  717.    * This function performs the details of file writing. It uses
  718.    * the file management routines in the "fileio.c" package. The
  719.    * number of lines written is displayed. Several errors are
  720. !  * possible, and cause writeout to return a FALSE result. When
  721.    * $ssave is TRUE,  the buffer is written out to a temporary
  722.    * file, and then the old file is unlinked and the temporary
  723.    * renamed to the original name.  Before the file is written,
  724. ***************
  725. *** 654,662 ****
  726.   #endif
  727.               /* erase original file */
  728.               /* rename temporary file to original name */
  729.               if (unlink(fn) == 0 && rename(tname, fn) == 0) {
  730. ! #if    BSD | SUN | V7
  731. !                 chmod(fn, (int)st.st_uid, (int)st.st_gid);
  732.                   chmod(fn, (int)st.st_mode);
  733.   #else
  734.                   ;
  735. --- 664,676 ----
  736.   #endif
  737.               /* erase original file */
  738.               /* rename temporary file to original name */
  739. + #if    BACKUP
  740. +             if (makebackup(fn) == TRUE && rename(tname, fn) == 0) {
  741. + #else
  742.               if (unlink(fn) == 0 && rename(tname, fn) == 0) {
  743. ! #endif
  744. ! #if    V7 | USG | HPUX | BSD | SUN | XENIX
  745. !                 chown(fn, (int)st.st_uid, (int)st.st_gid);
  746.                   chmod(fn, (int)st.st_mode);
  747.   #else
  748.                   ;
  749. ***************
  750. *** 870,872 ****
  751. --- 884,1018 ----
  752.       return(TRUE);
  753.   }
  754.   
  755. +                                    /* -- ZU */
  756. + /* Make a backup file.
  757. +  * This is done by renaming the original file to a new name.
  758. +  * The name of the backup file is defined as follows:
  759. +  *
  760. +  * MSDOS: The base file name remains untouched, the extension has a tilde (~)
  761. +  *      as its first character and the other characters moved one place
  762. +  *      to the right.
  763. +  * UNIX:  The first character is a '#'. The rest of the name is moved one
  764. +  *      place to the right. The length of the filename may not exceed 14
  765. +  *      characters (for BSD the limit is 255).
  766. +  *
  767. +  * No other operating system supported by now.
  768. +  */
  769. + #if    BACKUP
  770. + PASCAL NEAR makebackup( filename )
  771. + char    *filename;
  772. + {
  773. +     char    backupname[NFILEN];
  774. + #if     MSDOS | OS2 | V7 | USG | HPUX | BSD | SUN | XENIX
  775. +     if ( curbp->b_bupflg ||            /* already backed up  */
  776. +          !bakfile                /* no backup file wanted */
  777. +                 ) {
  778. +         if( unlink( filename ) == 0 )
  779. +             return( TRUE );
  780. +         else
  781. +             return( FALSE );
  782. +     }
  783. +     getbackupname( backupname, filename );
  784. +     if( !fexist( filename ))        /* no original file - */
  785. +         return( TRUE );            /* nothing to backup  */
  786. +     if( fexist( backupname ))
  787. +         if( unlink( backupname ))    /* file is readonly */
  788. +             return( FALSE );
  789. +     if( rename( filename, backupname ) != 0 )
  790. +         return( FALSE );
  791. +     return( TRUE );
  792. + #else            /* for all other operating systems return fail */
  793. +     return( FALSE );
  794. + #endif    /* MSDOS | V7 | USG | HPUX | BSD | SUN | XENIX */
  795. + }
  796. + /* Make the name of the backup file according to the original file name
  797. +  * This routines knows about the filename possibilities of the different
  798. +  * operating systems.
  799. +  */
  800. + PASCAL NEAR getbackupname( backup, file )
  801. + char    *backup;
  802. + char    *file;
  803. + {
  804. +     char    temp[NFILEN];
  805. +     int    index;
  806. +     char    *dotpos;
  807. +     strcpy( backup, file );
  808. + #if     MSDOS | OS2
  809. +     for( index = strlen( backup ) -1; index >= 0 && backup[index] != '.';
  810. +                                 index-- )
  811. +         ;
  812. +     if( index < 0 )
  813. +         strcat( backup, ".~" );
  814. +     else {
  815. +         strcpy( temp, &backup[index +1] );
  816. +         backup[index +1] = '~';    /* first char of new extension    */
  817. +         temp[2] = '\0';        /* extension is at most 3 chars    */
  818. +         strcpy( &backup[index +2], temp );
  819. +     }
  820. + #endif    /* MSDOS */
  821. + #if    V7 | USG | HPUX | BSD | SUN | XENIX
  822. + /*    strcpy( temp, "#" ); */
  823. +     *temp = 0;
  824. +     for( index = strlen( backup ) -1; index >= 0 && backup[index] != '/';
  825. +                                 index-- )
  826. +         ;
  827. +     if( index >= 0 )
  828. +             strcat( temp, &backup[index +1] );
  829. +     else
  830. +         strncat( temp, backup, NFILEN -1 );
  831. + #if    BSD    /* BSD allows filenames    up to 255 characters    */
  832. + #if    NFILEN < 255
  833. +     if( strlen( temp ) > NFILEN )
  834. +         temp[NFILEN] = '\0';
  835. + #else
  836. +     if( strlen( temp ) > 254 )
  837. +         temp[255] = '\0';
  838. + #endif
  839. + #else        /* other Unixes allow only 14 characters    */
  840. +     if( strlen( temp ) > 12 )
  841. +         temp[ 13] = '\0';
  842. + #endif
  843. +     strcat(temp,"-");
  844. +     if( index >= 0 )
  845. +         strncpy( &backup[index +1], temp, NFILEN - strlen( backup ) -1 );
  846. +     else
  847. +         strncpy( backup, temp, NFILEN - strlen( backup ) -1 );
  848. + #endif    /* V7 | USG | HPUX | BSD | SUN | XENIX */
  849. + }
  850. + #endif    /* BACKUP */
  851. + #if    CHDIR
  852. + /*
  853. +  * Change current working directory
  854. +  */
  855. + PASCAL NEAR changedir(f, n)
  856. + int f, n;
  857. + {
  858. +     char buf[NSTRING + 32];    /* message buffer */
  859. +     char *fname;    /* file user wishes to find */    /* file name */
  860. +     register int s;        /* status return */
  861. +     if (restflag)        /* don't allow this command if restricted */
  862. +         return(resterr());
  863. +     if ((fname = gtfilename("New directory")) != NULL)
  864. +         changecwd(fname);
  865. +     strcpy(buf, "Current directory = ");
  866. +     getcwd(buf + 20, NSTRING);
  867. +     mlwrite(buf);
  868. +     return(TRUE);
  869. + }
  870. + #endif
  871. diff -cbr src-orig/ibmpc.c src/ibmpc.c
  872. *** src-orig/ibmpc.c    Mon Dec 16 11:42:18 1991
  873. --- src/ibmpc.c    Sun Dec 22 16:19:06 1991
  874. ***************
  875. *** 14,21 ****
  876.   #include    "elang.h"
  877.   
  878.   #if     IBMPC
  879. ! #define NROW    50            /* Max Screen size.        */
  880. ! #define NCOL    80                      /* Edit if you want to.         */
  881.   #define    MARGIN    8            /* size of minimim margin and    */
  882.   #define    SCRSIZ    64            /* scroll size for extended lines */
  883.   #define    NPAUSE    200            /* # times thru update to pause */
  884. --- 14,21 ----
  885.   #include    "elang.h"
  886.   
  887.   #if     IBMPC
  888. ! #define NROW    80                      /* Max Screen size.             */
  889. ! #define NCOL    140                     /* Edit if you want to.         */
  890.   #define    MARGIN    8            /* size of minimim margin and    */
  891.   #define    SCRSIZ    64            /* scroll size for extended lines */
  892.   #define    NPAUSE    200            /* # times thru update to pause */
  893. ***************
  894. *** 419,432 ****
  895. --- 419,442 ----
  896.       ttclose();
  897.   }
  898.   
  899. + static CtrlC_State;                           /* -- ZU */
  900.   PASCAL NEAR ibmkopen()    /* open the keyboard */
  901.   
  902.   {
  903. +     rg.x.ax = 0x3300;                       /* -- ZU */
  904. +     intdos( &rg, &rg );                       /*     . */
  905. +     CtrlC_State = rg.h.dl;                       /* -- UZ */
  906. +       rg.x.ax = 0x3301;
  907. +       rg.h.dl = 0x00;
  908. +       intdos(&rg, &rg);
  909.   }
  910.   
  911.   PASCAL NEAR ibmkclose() /* close the keyboard */
  912.   
  913.   {
  914. +     rg.x.ax = 0x3301;                       /* -- ZU */
  915. +     rg.h.dl = CtrlC_State;                       /*     . */
  916. +     intdos(&rg, &rg);                       /* -- UZ */
  917.   }
  918.   
  919.   PASCAL NEAR scinit(type) /* initialize the screen head pointers */
  920. diff -cbr src-orig/input.c src/input.c
  921. *** src-orig/input.c    Mon Dec 16 11:42:20 1991
  922. --- src/input.c    Sun Dec 22 17:05:42 1991
  923. ***************
  924. *** 46,51 ****
  925. --- 46,60 ----
  926.   #include    "edef.h"
  927.   #include    "elang.h"
  928.   
  929. + #if USG | BSD | V7
  930. + #include    <sys/types.h>
  931. + #include    <pwd.h>
  932. + extern    struct passwd *getpwnam();
  933. + #if USG
  934. + #define    index    strchr
  935. + #endif
  936. + #endif
  937.   /*
  938.    * Ask a yes or no question in the message line. Return either TRUE, FALSE, or
  939.    * ABORT. The ABORT status is returned if the user bumps out of the question
  940. ***************
  941. *** 218,223 ****
  942. --- 227,236 ----
  943.       register int ec;    /* extended input character */
  944.       int cpos;        /* current column on screen output */
  945.       static char buf[NSTRING];/* buffer to hold tentative name */
  946. + #if USG | BSD | V7 | XENIX
  947. +     char *home;
  948. +     struct passwd *pwd;
  949. + #endif
  950.   
  951.       /* if we are executing a command line get the next arg and match it */
  952.       if (clexec) {
  953. ***************
  954. *** 296,303 ****
  955.               TTflush();
  956.               if (buf[cpos - 1] == 0)
  957.                   return(buf);
  958.           } else {
  959. !             if (cpos < maxlen && c > ' ') {
  960.                   buf[cpos++] = c;
  961.                   mlout(c);
  962.                   ++ttcol;
  963. --- 309,383 ----
  964.               TTflush();
  965.               if (buf[cpos - 1] == 0)
  966.                   return(buf);
  967. + #if USG | BSD | V7 | XENIX
  968. +         } else if (c == '/' && type == CMP_FILENAME && buf[0] == '~') {
  969. +             int i;
  970. +             if (cpos == 1) {
  971. +                 if (home = (char *)getenv("HOME")) {
  972. +                     mlout('\b');    /* backup over ~ */
  973. +                     mlout(' ');
  974. +                     mlout('\b');
  975. +                     ttcol--;
  976. +                     TTflush();
  977. +                     strcpy(buf, home);
  978. +                     cpos = strlen(buf);
  979. +                     if (buf[cpos-1] != '/')
  980. +                         buf[cpos++] = '/';
  981. +                     for (i = 0; i < cpos; i++) {
  982. +                         mlout(buf[i]);
  983. +                         ttcol++;
  984. +                     }
  985. +                     TTflush();
  986. +                 } else
  987. +                     goto nextc;
  988. +             } else {
  989. +                 buf[cpos] = '\0';
  990. +                 if (pwd = getpwnam(&buf[1])) {
  991. +                     while (cpos != 0) {    /* kill    */
  992. +                         mlout('\b');    /* line    */
  993. +                         mlout(' ');
  994. +                         mlout('\b');
  995. +                         --cpos;
  996. +                         --ttcol;
  997. +                     }
  998. +                     TTflush();
  999. +                     strcpy(buf, pwd->pw_dir);
  1000. +                     cpos = strlen(buf);
  1001. +                     if (buf[cpos-1] != '/')
  1002. +                         buf[cpos++] = '/';
  1003. +                     for (i = 0; i < cpos; i++) {
  1004. +                         mlout(buf[i]);
  1005. +                         ttcol++;
  1006. +                     }
  1007. +                     TTflush();
  1008. +                 } else
  1009. +                     goto nextc;
  1010. +             }
  1011. +         } else if (c == '/' && type == CMP_FILENAME && buf[0] == '$') {
  1012. +             int i;
  1013. +             buf[cpos] = '\0';
  1014. +             if (home = (char *)getenv(&buf[1])) {
  1015. +                 while (cpos != 0) {    /* kill    */
  1016. +                     mlout('\b');    /* line    */
  1017. +                     mlout(' ');
  1018. +                     mlout('\b');
  1019. +                     --cpos;
  1020. +                     --ttcol;
  1021. +                 }
  1022. +                 TTflush();
  1023. +                 strcpy(buf, home);
  1024. +                 cpos = strlen(buf);
  1025. +                 buf[cpos++] = '/';
  1026. +                 for (i = 0; i < cpos; i++) {
  1027. +                     mlout(buf[i]);
  1028. +                     ttcol++;
  1029. +                 }
  1030. +                 TTflush();
  1031. +             } else
  1032. +                 goto nextc;
  1033. + #endif
  1034.           } else {
  1035. ! nextc:            if (cpos < maxlen && c > ' ') {
  1036.                   buf[cpos++] = c;
  1037.                   mlout(c);
  1038.                   ++ttcol;
  1039. ***************
  1040. *** 482,488 ****
  1041. --- 562,572 ----
  1042.       while (fname) {
  1043.   
  1044.           /* is this a match? */
  1045. + #if    OS2
  1046. +         if (strnicmp(name,fname,*cpos) == 0) {
  1047. + #else
  1048.           if (strncmp(name,fname,*cpos) == 0) {
  1049. + #endif
  1050.   
  1051.               /* count the number of matches */
  1052.               matches++;
  1053. ***************
  1054. *** 515,524 ****
  1055. --- 599,615 ----
  1056.           return;
  1057.       }
  1058.   
  1059. +     while (*cpos != 0) {
  1060. +         mlout('\b');    /* clear the old prefix out, just in case */
  1061. +         (*cpos)--;      /* the case of the name has changed (OS/2) */
  1062. +         ttcol--;
  1063. +     }
  1064.       /* the longestmatch array contains the longest match so copy and print it */
  1065.       for ( ; (*cpos < (NSTRING-1)) && (*cpos < longestlen); (*cpos)++) {
  1066.           name[*cpos] = longestmatch[*cpos];
  1067.           TTputc(name[*cpos]);
  1068. +                 ttcol++;
  1069.       }
  1070.   
  1071.       name[*cpos] = 0;
  1072. diff -cbr src-orig/keyboard.c src/keyboard.c
  1073. *** src-orig/keyboard.c    Mon Dec 16 11:42:20 1991
  1074. --- src/keyboard.c    Sun Dec 22 16:19:06 1991
  1075. ***************
  1076. *** 74,81 ****
  1077. --- 74,85 ----
  1078.       /* some others as well */
  1079.       switch (c) {
  1080.   
  1081. + case 1:         return(ALTD | CTRL | '[');
  1082.   case 3:        return(0);            /* null */
  1083.   case 0x0F:    return(SHFT | CTRL | 'I');    /* backtab */
  1084. + case 0x94:      return(SPEC | CTRL | 'I');      /* ctrl tab */
  1085. + case 0xA5:      return(ALTD | CTRL | 'I');      /* alt tab */
  1086.   
  1087.   case 0x10:    return(ALTD | 'Q');
  1088.   case 0x11:    return(ALTD | 'W');
  1089. diff -cbr src-orig/line.c src/line.c
  1090. *** src-orig/line.c    Mon Dec 16 11:42:20 1991
  1091. --- src/line.c    Sun Dec 22 16:19:08 1991
  1092. ***************
  1093. *** 838,843 ****
  1094. --- 838,882 ----
  1095.       return(TRUE);
  1096.   }
  1097.   
  1098. + /*
  1099. +  * Delete the line the cursor is on
  1100. +  */
  1101. + PASCAL    NEAR    delline(f, n)
  1102. + int f, n;
  1103. + {
  1104. + /*        Use the lines associated with  i  in order to keep the
  1105. +         cursor in the same column when deleting a line.  If you
  1106. +         comment these lines out then the cursor will revert to
  1107. +         the first column.                    */
  1108. +  int    i,i1;
  1109. +     i1 = lastflag;
  1110. +         i = getccol(FALSE);
  1111. +     gotobol(f,n);
  1112. +     lastflag = thisflag;
  1113. +     thisflag = 0;
  1114. +     setmark(f,n);
  1115. +     lastflag = thisflag;
  1116. +     thisflag = 0;
  1117. +     forwline(f,n);
  1118. +     lastflag = i1;        /* This so if several lines are killed at the */
  1119. +     thisflag = 0;        /* same time, they will all go into the same  */
  1120. +     killregion(f, n);    /* kill buffer                      */
  1121. +     curgoal = i;
  1122. +     curwp->w_doto = getgoal(curwp->w_dotp);
  1123. +     lastflag = i1;
  1124. +     return(TRUE);
  1125. + }
  1126.   /*
  1127.    * Delete all of the text saved in the kill buffer. Called by commands when a
  1128.    * new kill context is being created. The kill buffer array is released, just
  1129. diff -cbr src-orig/main.c src/main.c
  1130. *** src-orig/main.c    Mon Dec 16 11:42:20 1991
  1131. --- src/main.c    Sun Dec 22 16:19:08 1991
  1132. ***************
  1133. *** 218,227 ****
  1134.   #if WMCS
  1135.           if (argv[carg][0] == ':') {
  1136.   #else
  1137. !         if (argv[carg][0] == '-') {
  1138.   #endif
  1139.               switch (argv[carg][1]) {
  1140.                   /* Process Startup macroes */
  1141.                   case 'c':    /* -c for changable file */
  1142.                   case 'C':
  1143.                       viewflag = FALSE;
  1144. --- 218,242 ----
  1145.   #if WMCS
  1146.           if (argv[carg][0] == ':') {
  1147.   #else
  1148. !         if (argv[carg][0] == '-' || argv[carg][0] == '+') {
  1149. !             /*         ^^^^^^^^^^^^^^^^^^^^^^^   */
  1150. !             /*         added by J.Bayer to allow */
  1151. !             /*        compatability with vi       */
  1152.   #endif
  1153. + /* J.Bayer, 9/22/88 */
  1154. +             if  (argv[carg][0] == '+') {    /* + to emulate vi */
  1155. +                     gotoflag = TRUE;
  1156. +                     gline = asc_int(&argv[carg][1]);
  1157. +             } else
  1158.               switch (argv[carg][1]) {
  1159.                   /* Process Startup macroes */
  1160. + #ifdef    BACKUP
  1161. +                         /* J. Bayer    9/22/88 */
  1162. +                 case 'b':    /* -b for no bakfile creation */
  1163. +                 case 'B':
  1164. +                     bakfile = FALSE;
  1165. +                     break;
  1166. + #endif
  1167.                   case 'c':    /* -c for changable file */
  1168.                   case 'C':
  1169.                       viewflag = FALSE;
  1170. ***************
  1171. *** 881,886 ****
  1172. --- 896,902 ----
  1173.       prefix |= META;
  1174.       prenum = n;
  1175.       predef = f;
  1176. +     thisflag = lastflag; /* jbayer */
  1177.       return(TRUE);
  1178.   }
  1179.   
  1180. ***************
  1181. *** 892,897 ****
  1182. --- 908,914 ----
  1183.       prefix |= CTLX;
  1184.       prenum = n;
  1185.       predef = f;
  1186. +     thisflag = lastflag; /* jbayer */
  1187.       return(TRUE);
  1188.   }
  1189.   
  1190. diff -cbr src-orig/mouse.c src/mouse.c
  1191. *** src-orig/mouse.c    Mon Dec 16 11:42:20 1991
  1192. --- src/mouse.c    Sun Dec 22 16:19:10 1991
  1193. ***************
  1194. *** 600,605 ****
  1195. --- 600,607 ----
  1196.   int row;
  1197.   
  1198.   {
  1199. +     if (wp==NULL)
  1200. +         return(FALSE);
  1201.       if (row == wp->w_toprow+wp->w_ntrows && modeflag)
  1202.           return(TRUE);
  1203.       return(FALSE);
  1204. diff -cbr src-orig/msdos.c src/msdos.c
  1205. *** src-orig/msdos.c    Mon Dec 16 11:42:20 1991
  1206. --- src/msdos.c    Sun Dec 22 16:19:12 1991
  1207. ***************
  1208. *** 27,32 ****
  1209. --- 27,33 ----
  1210.   struct ffblk fileblock;    /* structure for directory searches */
  1211.   #endif
  1212.   #if    MSC | ZTC
  1213. + #include <direct.h>
  1214.   #include <dos.h>
  1215.   
  1216.   struct find_t fileblock;    /* structure for directory searches */
  1217. ***************
  1218. *** 42,47 ****
  1219. --- 43,55 ----
  1220.   #include    <process.h>
  1221.   #endif
  1222.   
  1223. + #if     MSC
  1224. + #ifdef SWAPLIB
  1225. + #include <swaplib.h>
  1226. + #define spawnl(m, n1, n2, a, x)  swap_spawnlp(n1, n2, a, x)
  1227. + #endif
  1228. + #endif
  1229.   /*    Some global variable    */
  1230.   #define INBUFSIZ    40
  1231.   static int mexist;    /* is the mouse driver installed? */
  1232. ***************
  1233. *** 114,120 ****
  1234.   #if    MSC | TURBO | DTL | LATTICE | MWC
  1235.       int86x(0x21, &rg, &rg, &segreg);
  1236.       miaddr = (((long)segreg.es) << 16) + (long)rg.x.bx;
  1237. !     if (miaddr == 0 || *(char * far)miaddr == 0xcf) {
  1238.   #endif
  1239.   #if    ZTC
  1240.       int86x(0x21, &rg, &rg, &segreg);
  1241. --- 122,128 ----
  1242.   #if    MSC | TURBO | DTL | LATTICE | MWC
  1243.       int86x(0x21, &rg, &rg, &segreg);
  1244.       miaddr = (((long)segreg.es) << 16) + (long)rg.x.bx;
  1245. !     if (miaddr == 0 || *(char far *) miaddr == 0xcf) {
  1246.   #endif
  1247.   #if    ZTC
  1248.       int86x(0x21, &rg, &rg, &segreg);
  1249. ***************
  1250. *** 440,449 ****
  1251. --- 448,459 ----
  1252.           movecursor(term.t_nrow, 0);             /* Seek to last line.   */
  1253.           TTflush();
  1254.       TTkclose();
  1255. +     TTclose();                           /* -- ZU */
  1256.       shellprog("");
  1257.   #if    WINDOW_TEXT
  1258.       refresh_screen(first_screen);
  1259.   #endif
  1260. +     TTopen();                           /* -- ZU */
  1261.       TTkopen();
  1262.           sgarbf = TRUE;
  1263.           return(TRUE);
  1264. ***************
  1265. *** 470,476 ****
  1266. --- 480,488 ----
  1267.                   return(s);
  1268.       movecursor(term.t_nrow - 1, 0);
  1269.       TTkclose();
  1270. +     TTclose();
  1271.           shellprog(line);
  1272. +     TTopen();
  1273.       TTkopen();
  1274.   
  1275.       /* if we are interactive, pause here */
  1276. ***************
  1277. *** 493,499 ****
  1278.    */
  1279.   
  1280.   PASCAL NEAR execprg(f, n)
  1281.   {
  1282.           register int s;
  1283.           char line[NLINE];
  1284. --- 505,511 ----
  1285.    */
  1286.   
  1287.   PASCAL NEAR execprg(f, n)
  1288. ! int f, n;
  1289.   {
  1290.           register int s;
  1291.           char line[NLINE];
  1292. ***************
  1293. *** 506,515 ****
  1294. --- 518,529 ----
  1295.                   return(s);
  1296.       movecursor(term.t_nrow - 1, 0);
  1297.       TTkclose();
  1298. +     TTclose();                           /* -- ZU */
  1299.           execprog(line);
  1300.   #if    WINDOW_TEXT
  1301.       refresh_screen(first_screen);
  1302.   #endif
  1303. +     TTopen();                           /* -- ZU */
  1304.       TTkopen();
  1305.       /* if we are interactive, pause here */
  1306.       if (clexec == FALSE) {
  1307. ***************
  1308. *** 579,588 ****
  1309. --- 593,604 ----
  1310.   
  1311.       /* execute the command */
  1312.       TTkclose();
  1313. +     TTclose();
  1314.           shellprog(line);
  1315.   #if    WINDOW_TEXT
  1316.       refresh_screen(first_screen);
  1317.   #endif
  1318. +     TTopen();
  1319.       TTkopen();
  1320.           sgarbf = TRUE;
  1321.   
  1322. ***************
  1323. *** 657,666 ****
  1324. --- 673,684 ----
  1325.       strcat(line," <fltinp >fltout");
  1326.       movecursor(term.t_nrow - 1, 0);
  1327.       TTkclose();
  1328. +     TTclose();
  1329.           shellprog(line);
  1330.   #if    WINDOW_TEXT
  1331.       refresh_screen(first_screen);
  1332.   #endif
  1333. +     TTopen();
  1334.       TTkopen();
  1335.           sgarbf = TRUE;
  1336.       s = TRUE;
  1337. ***************
  1338. *** 711,720 ****
  1339. --- 729,742 ----
  1340.       char *getenv();
  1341.   
  1342.       /*  detect current switch character and set us up to use it */
  1343. + #if 0
  1344.       regs.h.ah = 0x37;    /*  get setting data  */
  1345.       regs.h.al = 0x00;    /*  get switch character  */
  1346.       intdos(®s, ®s);
  1347.       swchar = (char)regs.h.dl;
  1348. + #else
  1349. +     swchar = '/';
  1350. + #endif
  1351.   
  1352.       /*  get name of system shell  */
  1353.       if ((shell = getenv("COMSPEC")) == NULL) {
  1354. ***************
  1355. *** 754,764 ****
  1356.   char *cmd;    /*  Incoming command line to execute  */
  1357.   
  1358.   {
  1359. !     char *sp;        /* temporary string pointer */
  1360.       char f1[38];        /* FCB1 area (not initialized */
  1361.       char f2[38];        /* FCB2 area (not initialized */
  1362. -     char prog[NSTRING];    /* program filespec */
  1363. -     char tail[NSTRING];    /* command tail with length byte */
  1364.       union REGS regs;    /* parameters for dos call  */
  1365.   #if    MWC == 0
  1366.       struct SREGS segreg;    /* segment registers for dis call */
  1367. --- 776,784 ----
  1368.   char *cmd;    /*  Incoming command line to execute  */
  1369.   
  1370.   {
  1371. ! #ifndef NEWSPAWN
  1372.       char f1[38];        /* FCB1 area (not initialized */
  1373.       char f2[38];        /* FCB2 area (not initialized */
  1374.       union REGS regs;    /* parameters for dos call  */
  1375.   #if    MWC == 0
  1376.       struct SREGS segreg;    /* segment registers for dis call */
  1377. ***************
  1378. *** 769,774 ****
  1379. --- 789,799 ----
  1380.           char *fcb1;    /* 4 byte pointer to FCB at PSP+5Ch */
  1381.           char *fcb2;    /* 4 byte pointer to FCB at PSP+6Ch */
  1382.       } pblock;
  1383. + #endif
  1384. +     char *sp;        /* temporary string pointer */
  1385. +     char prog[NSTRING];    /* program filespec */
  1386. +     char tail[NSTRING];    /* command tail with length byte */
  1387. +     char curdir[NFILEN];    /* current directory save space */
  1388.   
  1389.       /* parse the command name from the command line */
  1390.       sp = prog;
  1391. ***************
  1392. *** 776,781 ****
  1393. --- 801,807 ----
  1394.           *sp++ = *cmd++;
  1395.       *sp = 0;
  1396.   
  1397. + #ifndef NEWSPAWN
  1398.       /* and parse out the command tail */
  1399.       while (*cmd && ((*cmd == ' ') || (*cmd == '\t')))
  1400.           ++cmd;
  1401. ***************
  1402. *** 782,787 ****
  1403. --- 808,814 ----
  1404.       *tail = (char)(strlen(cmd)); /* record the byte length */
  1405.       strcpy(&tail[1], cmd);
  1406.       strcat(&tail[1], "\r");
  1407. + #endif
  1408.   
  1409.       /* look up the program on the path trying various extentions */
  1410.       if ((sp = flook(prog, TRUE)) == NULL)
  1411. ***************
  1412. *** 792,797 ****
  1413. --- 819,827 ----
  1414.           }
  1415.       strcpy(prog, sp);
  1416.   
  1417. +     getcwd(curdir, sizeof(curdir));        /* save current directory */
  1418. + #ifndef NEWSPAWN
  1419.   #if    MWC == 0
  1420.       /* get a pointer to this PSPs environment segment number */
  1421.       segread(&segreg);
  1422. ***************
  1423. *** 858,863 ****
  1424. --- 888,897 ----
  1425.       } else
  1426.           rval = -_doserrno;    /* failed child call */
  1427.   #endif
  1428. + #else
  1429. +         rval = spawnl(P_WAIT, prog, prog, cmd, NULL);
  1430. + #endif
  1431. +     chdir( curdir );        /* restore current directory */
  1432.       return((rval < 0) ? FALSE : TRUE);
  1433.   }
  1434.   
  1435. ***************
  1436. *** 1052,1054 ****
  1437. --- 1086,1105 ----
  1438.   #endif
  1439.   #endif
  1440.   #endif
  1441. + #if    CHDIR
  1442. + changecwd(dir)
  1443. + char *dir;
  1444. + {
  1445. +     char drive[5];
  1446. +     unsigned total;
  1447. +     _splitpath(dir, drive, NULL, NULL, NULL);
  1448. +     if ( drive[0] != 0 )
  1449. +         _dos_setdrive(toupper(drive[0]) - '@', &total);
  1450. +     chdir(dir);
  1451. + }
  1452. + #endif
  1453. diff -cbr src-orig/os2.c src/os2.c
  1454. *** src-orig/os2.c    Mon Dec 16 11:42:20 1991
  1455. --- src/os2.c    Sun Dec 22 16:42:30 1991
  1456. ***************
  1457. *** 11,16 ****
  1458. --- 11,18 ----
  1459.   
  1460.   */
  1461.   
  1462. + #define INCL_BASE
  1463. + #define INCL_NOPM
  1464.   #define INCL_DOS
  1465.   #include "os2.h"
  1466.   
  1467. ***************
  1468. *** 19,35 ****
  1469.   #undef    PASCAL
  1470.   #undef    NEAR
  1471.   #undef    HIBYTE
  1472.   
  1473.   #include    "estruct.h"
  1474.   #include    "eproto.h"
  1475.   
  1476.   #if    OS2
  1477. - #define INCL_BASE
  1478.   
  1479.   #include "elang.h"
  1480.   #include "edef.h"
  1481.   
  1482.   
  1483.   /*
  1484.    * Create a subjob with a copy of the command intrepreter in it. When the
  1485.    * command interpreter exits, mark the screen as garbage so that you do a full
  1486. --- 21,39 ----
  1487.   #undef    PASCAL
  1488.   #undef    NEAR
  1489.   #undef    HIBYTE
  1490. + #undef    COLOR
  1491.   
  1492.   #include    "estruct.h"
  1493.   #include    "eproto.h"
  1494.   
  1495.   #if    OS2
  1496.   
  1497.   #include "elang.h"
  1498.   #include "edef.h"
  1499.   
  1500. + #include <process.h>
  1501.   
  1502.   /*
  1503.    * Create a subjob with a copy of the command intrepreter in it. When the
  1504.    * command interpreter exits, mark the screen as garbage so that you do a full
  1505. ***************
  1506. *** 37,42 ****
  1507. --- 41,47 ----
  1508.    * Under some (unknown) condition, you don't get one free when DCL starts up.
  1509.    */
  1510.   spawncli(f, n)
  1511. + int f, n;
  1512.   {
  1513.       /* don't allow this command if restricted */
  1514.       if (restflag)
  1515. ***************
  1516. *** 58,63 ****
  1517. --- 63,69 ----
  1518.    * done. Bound to "C-X !".
  1519.    */
  1520.   spawn(f, n)
  1521. + int f, n;
  1522.   {
  1523.           register int s;
  1524.           char line[NLINE];
  1525. ***************
  1526. *** 90,95 ****
  1527. --- 96,102 ----
  1528.    */
  1529.   
  1530.   execprg(f, n)
  1531. + int f, n;
  1532.   {
  1533.           register int s;
  1534.           char line[NLINE];
  1535. ***************
  1536. *** 121,126 ****
  1537. --- 128,134 ----
  1538.    * MicroEMACS don't try to use the same file.
  1539.    */
  1540.   pipecmd(f, n)
  1541. + int f, n;
  1542.   {
  1543.       register WINDOW *wp;    /* pointer to new window */
  1544.       register BUFFER *bp;    /* pointer to buffer to zot */
  1545. ***************
  1546. *** 211,217 ****
  1547.    * MicroEMACS don't try to use the same file.
  1548.    */
  1549.   filter(f, n)
  1550.   {
  1551.       register int    s;    /* return status from CLI */
  1552.       register BUFFER *bp;    /* pointer to buffer to zot */
  1553. --- 219,225 ----
  1554.    * MicroEMACS don't try to use the same file.
  1555.    */
  1556.   filter(f, n)
  1557. ! int f, n;
  1558.   {
  1559.       register int    s;    /* return status from CLI */
  1560.       register BUFFER *bp;    /* pointer to buffer to zot */
  1561. ***************
  1562. *** 308,318 ****
  1563.           return(FALSE);        /*  No shell located  */
  1564.       }
  1565.   
  1566. !     /*
  1567. !      * We are actually setting up a shell inside a shell here.
  1568. !      * Is there a better way?
  1569. !      */
  1570. !     return(system(shell));
  1571.   }
  1572.   
  1573.   
  1574. --- 316,322 ----
  1575.           return(FALSE);        /*  No shell located  */
  1576.       }
  1577.   
  1578. !     return(spawnl(P_WAIT, shell, shell, NULL));
  1579.   }
  1580.   
  1581.   
  1582. ***************
  1583. *** 324,330 ****
  1584.       char         failName[NFILEN];
  1585.       char         prog[NSTRING];        /* name of program */
  1586.       USHORT         i;
  1587. !     PRESULTCODES     results;
  1588.       
  1589.   
  1590.       /*
  1591. --- 328,334 ----
  1592.       char         failName[NFILEN];
  1593.       char         prog[NSTRING];        /* name of program */
  1594.       USHORT         i;
  1595. !         RESULTCODES      results;
  1596.       
  1597.   
  1598.       /*
  1599. ***************
  1600. *** 352,360 ****
  1601. --- 356,367 ----
  1602.       if ((sp = flook(prog, TRUE)) == NULL)
  1603.           if ((sp = flook(strcat(prog, ".exe"), TRUE)) == NULL) {
  1604.               strcpy(&prog[strlen(prog)-4], ".com");
  1605. +             if ((sp = flook(prog, TRUE)) == NULL) {
  1606. +                     strcpy(&prog[strlen(prog)-4], ".cmd");
  1607.               if ((sp = flook(prog, TRUE)) == NULL)
  1608.                   return(FALSE);
  1609.           }
  1610. +         }
  1611.       strcpy(prog, sp);
  1612.   
  1613.       /*
  1614. ***************
  1615. *** 361,374 ****
  1616.        * Execute the program synchronously.  We wait for child
  1617.        * to return.
  1618.        */
  1619. !     return (0 == DosExecPgm( failName, NFILEN, EXEC_SYNC,
  1620. !                      args, 0, results, prog));
  1621.   }
  1622.   
  1623.       
  1624.   /*    FILE Directory routines        */
  1625.   
  1626. ! FILEFINDBUF pBuf;    /* buffer to hold file information */
  1627.   HDIR hDir;        /* directory handle */
  1628.   int num_found;        /* number of directory entries found/to find */
  1629.   
  1630. --- 368,381 ----
  1631.        * Execute the program synchronously.  We wait for child
  1632.        * to return.
  1633.        */
  1634. !         return (0 == DosExecPgm(failName, sizeof(failName), EXEC_SYNC,
  1635. !                   args, 0, &results, prog));
  1636.   }
  1637.   
  1638.       
  1639.   /*    FILE Directory routines        */
  1640.   
  1641. ! FILEFINDBUF fbuf;    /* buffer to hold file information */
  1642.   HDIR hDir;        /* directory handle */
  1643.   int num_found;        /* number of directory entries found/to find */
  1644.   
  1645. ***************
  1646. *** 415,430 ****
  1647.   
  1648.       /* and call for the first file */
  1649.       num_found = 1;
  1650. !     hDir = HDIR_CREATE;
  1651.       if (DosFindFirst(fname, &hDir, FILE_NORMAL|FILE_DIRECTORY,
  1652. !               &pBuf, sizeof(pBuf), &num_found, 0L) != 0)
  1653.           return(NULL);
  1654.   
  1655.       /* return the first file name! */
  1656.       strcpy(rbuf, path);
  1657. !     strcat(rbuf, pBuf.achName);
  1658. !     mklower(rbuf);
  1659. !     if (pBuf.attrFile == FILE_DIRECTORY)
  1660.           strcat(rbuf, DIRSEPSTR);
  1661.       return(rbuf);
  1662.   }
  1663. --- 422,437 ----
  1664.   
  1665.       /* and call for the first file */
  1666.       num_found = 1;
  1667. !     hDir = HDIR_SYSTEM;
  1668.       if (DosFindFirst(fname, &hDir, FILE_NORMAL|FILE_DIRECTORY,
  1669. !               &fbuf, sizeof(fbuf), &num_found, 0L) != 0)
  1670.           return(NULL);
  1671.   
  1672.       /* return the first file name! */
  1673.       strcpy(rbuf, path);
  1674. !     strcat(rbuf, fbuf.achName);
  1675. !     /* mklower(rbuf); */
  1676. !     if (fbuf.attrFile == FILE_DIRECTORY)
  1677.           strcat(rbuf, DIRSEPSTR);
  1678.       return(rbuf);
  1679.   }
  1680. ***************
  1681. *** 438,451 ****
  1682.       char fname[NFILEN];        /* file/path for DOS call */
  1683.   
  1684.       /* and call for the next file */
  1685. !     if (DosFindNext(hDir, (void *)&pBuf, sizeof(pBuf), &num_found) != 0)
  1686.           return(NULL);
  1687.   
  1688.       /* return the first file name! */
  1689.       strcpy(rbuf, path);
  1690. !     strcat(rbuf, pBuf.achName);
  1691. !     mklower(rbuf);
  1692. !     if (pBuf.attrFile == FILE_DIRECTORY)
  1693.           strcat(rbuf, DIRSEPSTR);
  1694.       return(rbuf);
  1695.   }
  1696. --- 445,458 ----
  1697.       char fname[NFILEN];        /* file/path for DOS call */
  1698.   
  1699.       /* and call for the next file */
  1700. !     if (DosFindNext(hDir, (void *)&fbuf, sizeof(fbuf), &num_found) != 0)
  1701.           return(NULL);
  1702.   
  1703.       /* return the first file name! */
  1704.       strcpy(rbuf, path);
  1705. !     strcat(rbuf, fbuf.achName);
  1706. !     /* mklower(rbuf); */
  1707. !     if (fbuf.attrFile == FILE_DIRECTORY)
  1708.           strcat(rbuf, DIRSEPSTR);
  1709.       return(rbuf);
  1710.   }
  1711. ***************
  1712. *** 465,567 ****
  1713.       return(sp);
  1714.   }
  1715.   
  1716. ! #if    OBSOLETE
  1717. ! /*    extcode:    resolve MSDOS extended character codes
  1718. !             encoding the proper sequences into emacs
  1719. !             printable character specifications
  1720. ! */
  1721. ! int extcode(
  1722. !     unsigned c    /* byte following a zero extended char byte */
  1723. ! )
  1724. ! {
  1725. !     /* function keys 1 through 9 */
  1726. !     if (c >= 59 && c < 68)
  1727. !         return(SPEC | c - 58 + '0');
  1728. !     /* function key 10 */
  1729. !     if (c == 68)
  1730. !         return(SPEC | '0');
  1731. !     /* shifted function keys */
  1732. !     if (c >= 84 && c < 93)
  1733. !         return(SPEC | SHFT | c - 83 + '0');
  1734. !     if (c == 93)
  1735. !         return(SPEC | SHFT | '0');
  1736. !     /* control function keys */
  1737. !     if (c >= 94 && c < 103)
  1738. !         return(SPEC | CTRL | c - 93 + '0');
  1739. !     if (c == 103)
  1740. !         return(SPEC | CTRL | '0');
  1741. !     /* ALTed function keys */
  1742. !     if (c >= 104 && c < 113)
  1743. !         return(SPEC | ALTD | c - 103 + '0');
  1744. !     if (c == 113)
  1745. !         return(SPEC | ALTD | '0');
  1746. !     /* ALTed number keys */
  1747. !     if (c >= 120 && c < 129)
  1748. !         return(ALTD | c - 119 + '0');
  1749. !     if (c == 130)
  1750. !         return(ALTD | '0');
  1751. !     /* some others as well */
  1752. !     switch (c) {
  1753. !         case 3:        return(0);        /* null */
  1754. !         case 15:    return(SHFT | CTRL | 'I');    /* backtab */
  1755. !         case 16:    return(ALTD | 'Q');
  1756. !         case 17:    return(ALTD | 'W');
  1757. !         case 18:    return(ALTD | 'E');
  1758. !         case 19:    return(ALTD | 'R');
  1759. !         case 20:    return(ALTD | 'T');
  1760. !         case 21:    return(ALTD | 'Y');
  1761. !         case 22:    return(ALTD | 'U');
  1762. !         case 23:    return(ALTD | 'I');
  1763. !         case 24:    return(ALTD | 'O');
  1764. !         case 25:    return(ALTD | 'P');
  1765. !         case 30:    return(ALTD | 'A');
  1766. !         case 31:    return(ALTD | 'S');
  1767. !         case 32:    return(ALTD | 'D');
  1768. !         case 33:    return(ALTD | 'F');
  1769. !         case 34:    return(ALTD | 'G');
  1770. !         case 35:    return(ALTD | 'H');
  1771. !         case 36:    return(ALTD | 'J');
  1772. !         case 37:    return(ALTD | 'K');
  1773. !         case 38:    return(ALTD | 'L');
  1774. !         case 44:    return(ALTD | 'Z');
  1775. !         case 45:    return(ALTD | 'X');
  1776. !         case 46:    return(ALTD | 'C');
  1777. !         case 47:    return(ALTD | 'V');
  1778. !         case 48:    return(ALTD | 'B');
  1779. !         case 49:    return(ALTD | 'N');
  1780. !         case 50:    return(ALTD | 'M');
  1781. !         case 71:    return(SPEC | '<');    /* HOME */
  1782. !         case 72:    return(SPEC | 'P');    /* cursor up */
  1783. !         case 73:    return(SPEC | 'Z');    /* page up */
  1784. !         case 75:    return(SPEC | 'B');    /* cursor left */
  1785. !         case 77:    return(SPEC | 'F');    /* cursor right */
  1786. !         case 79:    return(SPEC | '>');    /* end */
  1787. !         case 80:    return(SPEC | 'N');    /* cursor down */
  1788. !         case 81:    return(SPEC | 'V');    /* page down */
  1789. !         case 82:    return(SPEC | 'C');    /* insert */
  1790. !         case 83:    return(SPEC | 'D');    /* delete */
  1791. !         case 115:    return(SPEC | CTRL | 'B');    /* control left */
  1792. !         case 116:    return(SPEC | CTRL | 'F');    /* control right */
  1793. !         case 117:    return(SPEC | CTRL | '>');    /* control END */
  1794. !         case 118:    return(SPEC | CTRL | 'V');    /* control page down */
  1795. !         case 119:    return(SPEC | CTRL | '<');    /* control HOME */
  1796. !         case 132:    return(SPEC | CTRL | 'Z');    /* control page up */
  1797. !     }
  1798.   
  1799. !     return(ALTD | c);
  1800.   }
  1801. ! #endif    /* obsolete */
  1802.   #endif
  1803.   
  1804. --- 472,492 ----
  1805.       return(sp);
  1806.   }
  1807.   
  1808. ! #if    CHDIR
  1809. ! changecwd(dir)
  1810. ! char *dir;
  1811. ! {
  1812. !     char drive[5];
  1813.   
  1814. !     _splitpath(dir, drive, NULL, NULL, NULL);
  1815. !     if ( drive[0] != 0 )
  1816. !                 DosSelectDisk(toupper(drive[0]) - '@');
  1817. !     chdir(dir);
  1818.   }
  1819. ! #endif
  1820.   #endif
  1821.   
  1822. diff -cbr src-orig/os2npm.c src/os2npm.c
  1823. *** src-orig/os2npm.c    Mon Dec 16 11:42:20 1991
  1824. --- src/os2npm.c    Sun Dec 22 16:19:16 1991
  1825. ***************
  1826. *** 12,17 ****
  1827. --- 12,18 ----
  1828.    */
  1829.   
  1830.   #define INCL_BASE
  1831. + #define INCL_NOPM
  1832.   #include    <os2.h>
  1833.   
  1834.   #define    termdef    1            /* don't define "term" external */
  1835. ***************
  1836. *** 18,23 ****
  1837. --- 19,25 ----
  1838.   
  1839.   #include    <stdio.h>
  1840.   
  1841. + #undef  COLOR
  1842.   #undef    PASCAL
  1843.   #undef    NEAR
  1844.   #undef    HIBYTE
  1845. ***************
  1846. *** 33,41 ****
  1847.    * We need COLOR as defined in estruct.h, so edit it out of os2def.h.
  1848.    */
  1849.   #include    <conio.h>
  1850.   
  1851. ! #define    NROW    50        /* Screen size.                 */
  1852. ! #define    NCOL    80        /* Edit if you want to.         */
  1853.   #define    MARGIN    8        /* size of minimim margin and    */
  1854.   #define    SCRSIZ    64        /* scroll size for extended lines */
  1855.   #define    NPAUSE    100        /* # times thru update to pause */
  1856. --- 35,44 ----
  1857.    * We need COLOR as defined in estruct.h, so edit it out of os2def.h.
  1858.    */
  1859.   #include    <conio.h>
  1860. + #include <stdlib.h>
  1861.   
  1862. ! #define    NROW    128        /* Screen size.                 */
  1863. ! #define    NCOL    140        /* Edit if you want to.         */
  1864.   #define    MARGIN    8        /* size of minimim margin and    */
  1865.   #define    SCRSIZ    64        /* scroll size for extended lines */
  1866.   #define    NPAUSE    100        /* # times thru update to pause */
  1867. ***************
  1868. *** 47,56 ****
  1869.   
  1870.   #define NDRIVE    4        /* number of video modes    */
  1871.   
  1872. ! int dtype = -1;                /* current video mode    */
  1873. ! char drvname[][8] = {            /* names of video modes    */
  1874. !     "CGA", "MONO", "EGA", "VGA"
  1875. ! };
  1876.   
  1877.   /* Forward references.          */
  1878.   
  1879. --- 50,57 ----
  1880.   
  1881.   #define NDRIVE    4        /* number of video modes    */
  1882.   
  1883. ! int mono = 0;
  1884.   
  1885.   /* Forward references.          */
  1886.   
  1887. ***************
  1888. *** 84,91 ****
  1889.   } os2rcell = {0, 0x07};
  1890.   
  1891.   static struct {                /* initial states        */
  1892. -     USHORT        ansiState;    /* ANSI translation        */
  1893. -     VIOCONFIGINFO    vioConfigInfo;    /* video configuration        */
  1894.       VIOMODEINFO    vioModeInfo;    /* video mode            */
  1895.       KBDINFO        kbdInfo;    /* keyboard info        */
  1896.   } initial;
  1897. --- 85,90 ----
  1898. ***************
  1899. *** 153,159 ****
  1900.   PASCAL NEAR os2fcol(
  1901.       int color)            /* color to set */
  1902.   {
  1903. !     if (dtype != CDMONO)
  1904.           cfcolor = ctrans[color];
  1905.       else
  1906.           cfcolor = 7;
  1907. --- 152,158 ----
  1908.   PASCAL NEAR os2fcol(
  1909.       int color)            /* color to set */
  1910.   {
  1911. !     if (!mono)
  1912.           cfcolor = ctrans[color];
  1913.       else
  1914.           cfcolor = 7;
  1915. ***************
  1916. *** 175,181 ****
  1917.   PASCAL NEAR os2bcol(
  1918.       int color)        /* color to set */
  1919.   {
  1920. !     if (dtype != CDMONO)
  1921.           cbcolor = ctrans[color];
  1922.       else
  1923.           cbcolor = 0;
  1924. --- 174,180 ----
  1925.   PASCAL NEAR os2bcol(
  1926.       int color)        /* color to set */
  1927.   {
  1928. !     if (!mono)
  1929.           cbcolor = ctrans[color];
  1930.       else
  1931.           cbcolor = 0;
  1932. ***************
  1933. *** 202,208 ****
  1934. --- 201,225 ----
  1935.   {
  1936.       os2row = row;
  1937.       os2col = col;
  1938. +         if ( _osmode == OS2_MODE )
  1939.       VioSetCurPos(os2row, os2col, 0);
  1940. +         else
  1941. +           _asm
  1942. +           {
  1943. +             mov ah,2
  1944. +             mov bh,0
  1945. +             mov dh,byte ptr os2row
  1946. +             mov dl,byte ptr os2col
  1947. +             int 0x10
  1948. +           }
  1949. + }
  1950. + os2vmove(                    /* speedup for special case in updateline */
  1951. +     int row,
  1952. +     int col)
  1953. + {
  1954. +     os2row = row;
  1955. +     os2col = col;
  1956.   }
  1957.   
  1958.   
  1959. ***************
  1960. *** 215,221 ****
  1961.   {
  1962.       if (lvbMin <= lvbMax) {        /* did anything change?    */
  1963.           VioShowBuf(lvbMin * 2, (lvbMax - lvbMin + 1) * 2, 0);
  1964. !         VioSetCurPos(os2row, os2col, 0);
  1965.       }
  1966.       lvbMin = lvbLen;
  1967.       lvbMax = 0;
  1968. --- 232,238 ----
  1969.   {
  1970.       if (lvbMin <= lvbMax) {        /* did anything change?    */
  1971.           VioShowBuf(lvbMin * 2, (lvbMax - lvbMin + 1) * 2, 0);
  1972. !         os2move(os2row, os2col);
  1973.       }
  1974.       lvbMin = lvbLen;
  1975.       lvbMax = 0;
  1976. ***************
  1977. *** 256,262 ****
  1978.   
  1979.       /* Function, edit or alt- key?    */
  1980.       if (keyInfo.chChar == 0  ||  keyInfo.chChar == 0xE0) {
  1981. !         nextc = extcode(keyInfo.chScan); /* hold on to scan code */
  1982.           return(0);
  1983.       }
  1984.       return(keyInfo.chChar & 255);
  1985. --- 273,280 ----
  1986.   
  1987.       /* Function, edit or alt- key?    */
  1988.       if (keyInfo.chChar == 0  ||  keyInfo.chChar == 0xE0) {
  1989. !         nextc = extcode(keyInfo.chScan | (keyInfo.chChar << 8));
  1990. !         /* hold on to scan code */
  1991.           return(0);
  1992.       }
  1993.       return(keyInfo.chChar & 255);
  1994. ***************
  1995. *** 294,300 ****
  1996.       USHORT    i;
  1997.   
  1998.       if (c == '\n' || c == '\r') {        /* returns and linefeeds */
  1999. !         return;
  2000.       }
  2001.       if (c == '\b') {            /* backspace        */
  2002.           cell = ' ' | (revflag ? *(USHORT *)&os2rcell : *(USHORT *)&os2cell);
  2003. --- 312,318 ----
  2004.       USHORT    i;
  2005.   
  2006.       if (c == '\n' || c == '\r') {        /* returns and linefeeds */
  2007. !         return 0;
  2008.       }
  2009.       if (c == '\b') {            /* backspace        */
  2010.           cell = ' ' | (revflag ? *(USHORT *)&os2rcell : *(USHORT *)&os2cell);
  2011. ***************
  2012. *** 347,353 ****
  2013.       USHORT  i;
  2014.   
  2015.   #if COLOR
  2016. !     if (dtype != CDMONO)
  2017.           cell |= (ctrans[gbcolor] << 4 | ctrans[gfcolor]) << 8;
  2018.       else
  2019.           cell |= 0x0700;
  2020. --- 365,371 ----
  2021.       USHORT  i;
  2022.   
  2023.   #if COLOR
  2024. !     if (!mono)
  2025.           cell |= (ctrans[gbcolor] << 4 | ctrans[gfcolor]) << 8;
  2026.       else
  2027.           cell |= 0x0700;
  2028. ***************
  2029. *** 382,425 ****
  2030.   /* Change the screen resolution.                    */
  2031.   /*----------------------------------------------------------------------*/
  2032.   
  2033.   PASCAL NEAR os2cres(char *res)        /* name of desired video mode    */
  2034.   {
  2035. !     USHORT    err;
  2036. !     int    type;            /* video mode type    */
  2037.       VIOMODEINFO vioModeInfo;
  2038.   
  2039.       vioModeInfo = initial.vioModeInfo;
  2040.       
  2041. !     /* From the name, find the type of video mode.    */
  2042. !     for (type = 0; type < NDRIVE; type++) {
  2043. !         if (strcmp(res, drvname[type]) == 0)
  2044. !             break;
  2045. !     }
  2046. !     if (type == NDRIVE)
  2047. !         return(FALSE);    /* not a mode we know about    */
  2048. !         
  2049. !     switch (type) {
  2050. !         case CDMONO:
  2051. !         case CDCGA:
  2052. !             vioModeInfo.row = 25;
  2053. !             break;
  2054. !         case CDEGA:
  2055. !             vioModeInfo.row = 43;
  2056. !             break;
  2057. !         case CDVGA:
  2058. !             vioModeInfo.row = 50;
  2059. !             break;
  2060. !     }
  2061.       
  2062. !     if (VioSetMode(&vioModeInfo, 0))    /* change modes     */
  2063. !         return(FALSE);            /* couldn't do it    */
  2064.   
  2065.       newsize(TRUE, vioModeInfo.row);
  2066.   
  2067.       /* reset the $sres environment variable */
  2068. !     strcpy(sres, drvname[type]);
  2069. !     dtype = type;                /* set the current mode    */
  2070.       
  2071.       return TRUE;
  2072.   }
  2073. --- 400,461 ----
  2074.   /* Change the screen resolution.                    */
  2075.   /*----------------------------------------------------------------------*/
  2076.   
  2077. + static int checkmode(VIOMODEINFO *vmi, int scans, int lines, int font)
  2078. + {
  2079. +         int diff = scans - lines * font;
  2080. +         if ( (0 <= diff) && (diff < font) )
  2081. +         {
  2082. +                 vmi -> vres = scans;
  2083. +                 vmi -> row = lines;
  2084. +                 return(TRUE);
  2085. +         }
  2086. +         else
  2087. +                 return(FALSE);
  2088. + }
  2089.   PASCAL NEAR os2cres(char *res)        /* name of desired video mode    */
  2090.   {
  2091. !     USHORT    lines;
  2092.       VIOMODEINFO vioModeInfo;
  2093.   
  2094. +         if ( ((lines = atoi(res)) < 16) || (lines >= NROW) )
  2095. +           return(FALSE);
  2096.       vioModeInfo = initial.vioModeInfo;
  2097. +         vioModeInfo.vres = vioModeInfo.vres / vioModeInfo.row * lines;
  2098. +         vioModeInfo.row = lines;
  2099.       
  2100. !     if (VioSetMode(&vioModeInfo, 0))
  2101. !         {
  2102. !                 /* only 350, 400 or 480 scan lines allowed ? */
  2103. !                 /* (i.e. full screen) */
  2104. !              vioModeInfo = initial.vioModeInfo;
  2105. !                 if ( !(checkmode(&vioModeInfo, 480, lines, 16) ||
  2106. !                        checkmode(&vioModeInfo, 480, lines, 14) ||
  2107. !                        checkmode(&vioModeInfo, 480, lines,  8) ||
  2108. !                        checkmode(&vioModeInfo, 400, lines, 16) ||
  2109. !                        checkmode(&vioModeInfo, 400, lines, 14) ||
  2110. !                        checkmode(&vioModeInfo, 400, lines,  8) ||
  2111. !                        checkmode(&vioModeInfo, 350, lines, 16) ||
  2112. !                        checkmode(&vioModeInfo, 350, lines, 14) ||
  2113. !                        checkmode(&vioModeInfo, 350, lines,  8))   )
  2114. !                         return(FALSE);
  2115.       
  2116. !                 vioModeInfo.hres = (vioModeInfo.vres == 350) ? 640 : 720;
  2117.   
  2118. +             if (VioSetMode(&vioModeInfo, 0))
  2119. +                         return(FALSE);
  2120. +         }
  2121. +     VioGetMode(&vioModeInfo, 0);
  2122. +         term.t_ncol = vioModeInfo.col;
  2123.       newsize(TRUE, vioModeInfo.row);
  2124.   
  2125.       /* reset the $sres environment variable */
  2126. !     itoa(vioModeInfo.row, sres, 10);
  2127.       
  2128.       return TRUE;
  2129.   }
  2130. ***************
  2131. *** 454,486 ****
  2132.   
  2133.   PASCAL NEAR os2open()
  2134.   {
  2135. !     initial.vioConfigInfo.cb = 0x0A;
  2136. !     VioGetConfig(0, &initial.vioConfigInfo, 0);
  2137. !     switch (initial.vioConfigInfo.adapter) {
  2138. !         case 3:
  2139. !             dtype = CDVGA;
  2140. !             break;
  2141. !         case 2:
  2142. !             dtype = CDEGA;
  2143. !             break;
  2144. !         case 1:
  2145. !             dtype = CDCGA;
  2146. !             break;
  2147. !         case 0:
  2148. !         default:
  2149. !             dtype = CDMONO;
  2150. !     }
  2151. !     strcpy(sres, drvname[dtype]);
  2152.   
  2153. !     initial.vioModeInfo.cb = 0x0E;
  2154.       VioGetMode(&initial.vioModeInfo, 0);
  2155. !     newsize(TRUE, initial.vioModeInfo.row);
  2156.               
  2157. !     VioGetAnsi(&initial.ansiState, 0);
  2158.       VioGetBuf((PULONG)&lvb, &lvbLen, 0);
  2159.       lvbMin = lvbLen;
  2160.       lvbMax = 0;
  2161.   
  2162.       revexist = TRUE;
  2163.       revflag = FALSE;
  2164.   }
  2165. --- 490,531 ----
  2166.   
  2167.   PASCAL NEAR os2open()
  2168.   {
  2169. !     VIOINTENSITY vi;
  2170. !     PFNSIGHANDLER oldhandler;
  2171. !     USHORT oldact;
  2172.   
  2173. !     initial.vioModeInfo.cb = sizeof(initial.vioModeInfo);
  2174.       VioGetMode(&initial.vioModeInfo, 0);
  2175. !         mono = (initial.vioModeInfo.color == COLORS_2);
  2176. !         if ( _osmode == OS2_MODE )
  2177. !         {
  2178. !           term.t_ncol = initial.vioModeInfo.col;
  2179. !           term.t_nrow = initial.vioModeInfo.row;
  2180. !         }
  2181. !         else
  2182. !         {
  2183. !           term.t_ncol = *((char *) 0x0040004AL);
  2184. !           term.t_nrow = *((char *) 0x00400084L) + 1;
  2185. !         }
  2186. !     newsize(TRUE, term.t_nrow);
  2187. !     itoa(term.t_nrow + 1, sres, 10);
  2188.               
  2189. !         vi.cb = sizeof(vi);
  2190. !         vi.type = 2;
  2191. !         vi.fs = 1;
  2192. !         VioSetState(&vi, 0);
  2193.       VioGetBuf((PULONG)&lvb, &lvbLen, 0);
  2194.       lvbMin = lvbLen;
  2195.       lvbMax = 0;
  2196.   
  2197. +     DosSetSigHandler((PFNSIGHANDLER) NULL, &oldhandler, &oldact,
  2198. +                      SIGA_IGNORE, SIG_CTRLBREAK);
  2199. +     DosSetSigHandler((PFNSIGHANDLER) NULL, &oldhandler, &oldact,
  2200. +                      SIGA_IGNORE, SIG_CTRLC);
  2201.       revexist = TRUE;
  2202.       revflag = FALSE;
  2203.   }
  2204. ***************
  2205. *** 493,502 ****
  2206.   
  2207.   PASCAL NEAR os2close()
  2208.   {
  2209. !     VioSetAnsi(initial.ansiState, 0);
  2210.       VioSetMode(&initial.vioModeInfo, 0);
  2211.       VioSetCurPos(initial.vioModeInfo.row - 1,
  2212.                initial.vioModeInfo.col - 1, 0);
  2213.   }
  2214.   
  2215.   /*----------------------------------------------------------------------*/
  2216. --- 538,551 ----
  2217.   
  2218.   PASCAL NEAR os2close()
  2219.   {
  2220. !         if ( _osmode == OS2_MODE )
  2221. !         {
  2222.       VioSetMode(&initial.vioModeInfo, 0);
  2223.       VioSetCurPos(initial.vioModeInfo.row - 1,
  2224.                initial.vioModeInfo.col - 1, 0);
  2225. +         }
  2226. +         else
  2227. +           os2move(term.t_nrow - 1, term.t_ncol - 1);
  2228.   }
  2229.   
  2230.   /*----------------------------------------------------------------------*/
  2231. ***************
  2232. *** 508,514 ****
  2233.   {
  2234.       KBDINFO    kbdInfo;
  2235.   
  2236. !     initial.kbdInfo.cb = 0x000A;
  2237.       KbdGetStatus(&initial.kbdInfo, 0);    
  2238.       kbdInfo = initial.kbdInfo;
  2239.       kbdInfo.fsMask &= ~0x0001;        /* not echo on        */
  2240. --- 557,563 ----
  2241.   {
  2242.       KBDINFO    kbdInfo;
  2243.   
  2244. !     initial.kbdInfo.cb = sizeof(initial.kbdInfo);
  2245.       KbdGetStatus(&initial.kbdInfo, 0);    
  2246.       kbdInfo = initial.kbdInfo;
  2247.       kbdInfo.fsMask &= ~0x0001;        /* not echo on        */
  2248. diff -cbr src-orig/random.c src/random.c
  2249. *** src-orig/random.c    Mon Dec 16 11:42:22 1991
  2250. --- src/random.c    Sun Dec 22 16:19:18 1991
  2251. ***************
  2252. *** 265,270 ****
  2253. --- 265,289 ----
  2254.                   stabsize = n;
  2255.                   return(TRUE);
  2256.           }
  2257. + #if    SOFTAB
  2258. +     if (curwp->w_bufp->b_mode & MDOVER)  {
  2259. +         if (! tabsize) {
  2260. +                    curgoal = getccol(FALSE) | 0x07;
  2261. +                curgoal++;
  2262. +            }
  2263. +            else {
  2264. +                curgoal = tabsize - (getccol(FALSE) % tabsize) + getccol(FALSE);
  2265. +         }
  2266. +         curwp->w_doto =  getgoal(curwp->w_dotp);
  2267. +            return(TRUE);
  2268. +     }
  2269. + #endif
  2270.           if (!stabsize)
  2271.                   return(linsert(1, '\t'));
  2272.           return(linsert(stabsize - (getccol(FALSE) % stabsize), ' '));
  2273. ***************
  2274. *** 451,456 ****
  2275. --- 470,497 ----
  2276.           return(s);
  2277.   }
  2278.   
  2279. + /*
  2280. +  * Toggle overwrite mode.  Bound to the ins key.
  2281. +  */
  2282. + PASCAL    NEAR    toggleovermode(f, n)    /* toggle overwrite mode */
  2283. + int    f, n;        /* default and argument */
  2284. + {
  2285. +     if (curwp->w_bufp->b_mode & MDOVER)
  2286. +     {
  2287. +         curwp->w_bufp->b_mode &= ~MDOVER;
  2288. +         curwp->w_bufp->b_mode |= MDREPL;
  2289. +     }
  2290. +     else if (curwp->w_bufp->b_mode & MDREPL)
  2291. +         curwp->w_bufp->b_mode &= ~MDREPL;
  2292. +         else
  2293. +         curwp->w_bufp->b_mode |= MDOVER;
  2294. +     upmode();
  2295. + }
  2296.   /*
  2297.    * Insert a newline. Bound to "C-M". If we are in CMODE, do automatic
  2298.    * indentation as specified.
  2299. ***************
  2300. *** 462,467 ****
  2301. --- 503,517 ----
  2302.   {
  2303.       register int    s;
  2304.   
  2305. + #if    SOFTAB
  2306. +     if (curwp->w_bufp->b_mode & MDOVER)  {
  2307. +         gotobol(f,1);
  2308. +         thisflag = 0;
  2309. +         return(forwline(f,1));
  2310. +     }
  2311. + #endif
  2312.       if (curbp->b_mode&MDVIEW)    /* don't allow this command if    */
  2313.           return(rdonly());    /* we are in read only mode    */
  2314.       if (n < 0)
  2315. ***************
  2316. *** 868,876 ****
  2317.       register char *scan;        /* scanning pointer to convert prompt */
  2318.       register int i;            /* loop index */
  2319.       register int status;        /* error return on input */
  2320. - #if    COLOR
  2321.       register int uflag;        /* was modename uppercase?    */
  2322. - #endif
  2323.       char prompt[50];    /* string to prompt user with */
  2324.       char cbuf[NPAT];        /* buffer to recieve mode name into */
  2325.   
  2326. --- 918,924 ----
  2327. ***************
  2328. *** 898,906 ****
  2329.       /* make it uppercase */
  2330.   
  2331.       scan = cbuf;
  2332. - #if    COLOR
  2333.       uflag = (*scan >= 'A' && *scan <= 'Z');
  2334. - #endif
  2335.       while (*scan)
  2336.           uppercase(scan++);
  2337.   
  2338. --- 946,952 ----
  2339. diff -cbr src-orig/unix.c src/unix.c
  2340. *** src-orig/unix.c    Mon Dec 16 11:42:24 1991
  2341. --- src/unix.c    Sun Dec 22 17:12:10 1991
  2342. ***************
  2343. *** 802,807 ****
  2344. --- 802,810 ----
  2345.       int status;
  2346.       struct capbind * cb;
  2347.       struct keybind * kp;
  2348. + #ifdef TIOCGWINSZ
  2349. +     struct winsize win;
  2350. + #endif
  2351.   
  2352.       char * getenv(), * tgetstr();
  2353.   #if HPUX
  2354. ***************
  2355. *** 831,840 ****
  2356.           exit(1);
  2357.       }
  2358.   
  2359.       /* Get size from termcap */
  2360.       term.t_nrow = tgetnum("li") - 1;
  2361.       term.t_ncol = tgetnum("co");
  2362. !     if (term.t_nrow < 3 || term.t_ncol < 3) {
  2363.           puts("Screen size is too small!");
  2364.           exit(1);
  2365.       }
  2366. --- 834,861 ----
  2367.           exit(1);
  2368.       }
  2369.   
  2370. +     term.t_nrow = -1;
  2371. +     term.t_ncol = -1;
  2372. + #ifdef TIOCGWINSZ
  2373. +     if (ioctl (0, TIOCGWINSZ, &win) == 0) {
  2374. +         if (win.ws_col)
  2375. +             term.t_ncol = win.ws_col;
  2376. +         else
  2377. +             term.t_ncol = -1;
  2378. +         if (win.ws_row)
  2379. +             term.t_nrow = win.ws_row - 1;
  2380. +         else
  2381. +             term.t_nrow = -1;
  2382. +     }
  2383. + #endif /* TIOCGWINSZ */
  2384.       /* Get size from termcap */
  2385. +         if ( term.t_nrow == -1 )
  2386.       term.t_nrow = tgetnum("li") - 1;
  2387. +         if ( term.t_ncol == -1 )
  2388.       term.t_ncol = tgetnum("co");
  2389. !     if (term.t_nrow < 15 || term.t_ncol < 64) {
  2390.           puts("Screen size is too small!");
  2391.           exit(1);
  2392.       }
  2393. ***************
  2394. *** 1537,1542 ****
  2395. --- 1558,1571 ----
  2396.       /* Return the next file name! */
  2397.       return(rbuf);
  2398.   }
  2399. + #if    CHDIR
  2400. + changecwd(dir)
  2401. + char *dir;
  2402. + {
  2403. +     chdir(dir);
  2404. + }
  2405. + #endif
  2406.   
  2407.   #if FLABEL
  2408.   int fnclabel(f, n)    /* label a function key */
  2409. diff -cbr src-orig/window.c src/window.c
  2410. *** src-orig/window.c    Mon Dec 16 11:42:24 1991
  2411. --- src/window.c    Sun Dec 22 16:19:20 1991
  2412. ***************
  2413. *** 37,43 ****
  2414. --- 37,46 ----
  2415.   
  2416.   {
  2417.       if (f == FALSE)
  2418. +         {
  2419.       sgarbf = TRUE;
  2420. +         thisflag = lastflag; /* jbayer */
  2421. +         }
  2422.       else
  2423.       {
  2424.       curwp->w_force = 0;        /* Center dot. */
  2425.