home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume38 / ee / patch02 < prev    next >
Encoding:
Text File  |  1993-07-13  |  50.0 KB  |  1,914 lines

  1. Newsgroups: comp.sources.misc
  2. From: hugh@nsmdserv.cnd.hp.com (Hugh F. Mahon)
  3. Subject: v38i054:  ee - Easy Editor, a simple editor for UNIX, Patch02
  4. Message-ID: <1993Jul14.143508.25254@sparky.sterling.com>
  5. Summary: a simple editor
  6. X-Md4-Signature: 7482f5333d0594eb2f37f60957095851
  7. Sender: kent@sparky.sterling.com (Kent Landfield)
  8. Reply-To: h_mahon@fc.hp.com
  9. Organization: HP Colorado Networks Division
  10. Date: Wed, 14 Jul 1993 14:35:08 GMT
  11. Approved: kent@sparky.sterling.com
  12.  
  13. Submitted-by: hugh@nsmdserv.cnd.hp.com (Hugh F. Mahon)
  14. Posting-number: Volume 38, Issue 54
  15. Archive-name: ee/patch02
  16. Environment: SYSV, BSD, Curses
  17. Patch-To: ee: Volume 35, Issue 80-84
  18.  
  19. Several people have asked for ee to work on BSD-based systems.  Some 
  20. changes have been made to new_curse to better support BSD and termcap.
  21.  
  22. Since many shells use emacs style key bindings, it was suggested that 
  23. emacs style bindings be made available in ee, so here they are.
  24.  
  25. Changes to ee:
  26.  
  27.     1. added support for window resizing
  28.     2. added emacs key bindings
  29.     3. changed so not writing into statically allocated memory for 
  30.        settings menu
  31.     4. changed name of abort() to edit_abort() to avoid namespace collision
  32.     5. fixed another NULL pointer de-reference
  33.     6. changed curses operation on shell operation to try to fix problems 
  34.        reported using 'spell'
  35.  
  36. Changes to new_curse:
  37.  
  38.     1. added support for resizing
  39.     2. fixed defects in termcap operations
  40.     3. changed operation on BSD systems for getting function keys
  41.     4. improved terminfo file checking
  42.  
  43. Changes to ee.1:
  44.  
  45.     1. Added documentation for emacs keys.
  46.     2. Modified so that page could be formatted on Coherent.
  47.  
  48. Made related changes to ee.msg and ee.i18n.guide.
  49.  
  50. Thanks are in order for Chuck Cranor for defect information for 
  51. new_curse, code for getting lines and columns from tty data structure, 
  52. select code for BSD systems (for getting function keys), and emacs key 
  53. mappings for ee. 
  54.  
  55. Thanks to Udo Monk for modifications to ee.1 to allow formatting on 
  56. Coherent.
  57.  
  58. To apply the patch, use the 'patch' utility, avaliable from many ftp 
  59. archive sites (such as wuarchive.wustl.edu) if you don't already have 
  60. it.  It is a valuable tool to have.
  61.  
  62. Hugh Mahon              |__|     
  63. h_mahon@fc.hp.com       |  |     
  64.                            |\  /|
  65.                            | \/ |
  66.  
  67. diff -cr ../ee-p1/Makefile ./Makefile
  68. *** ../ee-p1/Makefile    Sun Jul 11 19:52:08 1993
  69. --- ./Makefile    Sun Jul 11 19:49:10 1993
  70. ***************
  71. *** 15,20 ****
  72. --- 15,21 ----
  73.   # define.  If the system supports setlocale(), catopen(), and catgets() and 
  74.   # localization is desired, do not use -DNO_CATGETS.
  75.   #
  76. + # DEFINES is used for new_curse.c, and CFLAGS is used for ee.c.
  77.   #
  78.   
  79.   # for System V, using new_curse with terminfo
  80. ***************
  81. *** 21,27 ****
  82.   DEFINES =    -DSYS5 -DNCURSE 
  83.   
  84.   # for BSD, using new_curse with termcap
  85. ! #DEFINES =     -DCAP -DNCURSE
  86.   
  87.   # flags for compilation
  88.   CFLAGS = -s -DNO_CATGETS
  89. --- 22,31 ----
  90.   DEFINES =    -DSYS5 -DNCURSE 
  91.   
  92.   # for BSD, using new_curse with termcap
  93. ! #DEFINES =     -DCAP -DNCURSE 
  94. ! # for BSD systems with select(), using new_curse with termcap, use:
  95. ! #DEFINES =      -DCAP -DNCURSE -DBSD_SELECT 
  96.   
  97.   # flags for compilation
  98.   CFLAGS = -s -DNO_CATGETS
  99. diff -cr ../ee-p1/README.ee ./README.ee
  100. *** ../ee-p1/README.ee    Sun Jul 11 19:52:08 1993
  101. --- ./README.ee    Sun Jul 11 19:49:25 1993
  102. ***************
  103. *** 66,86 ****
  104.   will have a defect that reduces the usefulness of the editor relying upon 
  105.   it.  
  106.   
  107. ! The new_curse source is provided simply as a back up in case the curses on 
  108. ! your system has such a defect.  The code is a rather nasty hack, and can be 
  109. ! noticeably slower than real curses.  Also, although there is code for 
  110. ! handling non-System V systems, this code has been much less used, and so may 
  111. ! now be non-functional.  Likewise with the code for handling termcap.  I just 
  112. ! felt that since it was already there, I may as well leave it since someone 
  113. ! may find it useful.  While new_curse is somewhat poorly written code in some 
  114. ! places, it is source code that can be hacked if all else fails.  Note, 
  115. ! however, that if you're having problems, first make sure of the terminal 
  116. ! configuration, especially if you're using a terminal emulator, and make sure 
  117. ! that you are using the right terminfo entry before rummaging through code.  
  118. ! Terminfo entries often contain inaccuracies, or incomplete information, or 
  119. ! may not totally match the terminal or emulator the terminal information is 
  120. ! being used with.  Complaints that ee isn't working quite right often end up 
  121. ! being something else (like the terminal emulator being used). 
  122.   
  123.   Both ee and new_curse were developed using K&R C (also known as "classic 
  124.   C").  Some tweaks may be required to make ee and new_curse compile on 
  125. --- 66,85 ----
  126.   will have a defect that reduces the usefulness of the editor relying upon 
  127.   it.  
  128.   
  129. ! The new_curse source is provided simply as a back up in case the curses 
  130. ! on your system has such a defect.  The code is a rather nasty hack, and 
  131. ! can be noticeably slower than real curses.  new_curse works on both 
  132. ! System V and BSD based systems, with either terminfo or termcap.  While 
  133. ! new_curse is somewhat poorly written code in some places, it is source 
  134. ! code that can be hacked if all else fails.  Note, however, that if you're 
  135. ! having problems, first make sure of the terminal configuration, 
  136. ! especially if you're using a terminal emulator, and make sure that you 
  137. ! are using the right terminfo entry before rummaging through code.  
  138. ! Terminfo entries often contain inaccuracies, or incomplete information, 
  139. ! or may not totally match the terminal or emulator the terminal 
  140. ! information is being used with.  Complaints that ee isn't working quite 
  141. ! right often end up being something else (like the terminal emulator being 
  142. ! used).  
  143.   
  144.   Both ee and new_curse were developed using K&R C (also known as "classic 
  145.   C").  Some tweaks may be required to make ee and new_curse compile on 
  146. diff -cr ../ee-p1/ee.1 ./ee.1
  147. *** ../ee-p1/ee.1    Sun Jul 11 19:51:51 1993
  148. --- ./ee.1    Sun Jul 11 19:49:37 1993
  149. ***************
  150. *** 4,11 ****
  151.   .\"
  152.   .\"    nroff -man ee.1
  153.   .\"
  154. ! .\"  $Header: /users/hugh/tmp/old_ae/ee.1,v 1.14 1993/01/25 04:13:39 hugh Exp $
  155.   .\"
  156.   .TH ee 1 "" "" "" ""
  157.   .SH NAME
  158.   ee \- easy editor
  159. --- 4,12 ----
  160.   .\"
  161.   .\"    nroff -man ee.1
  162.   .\"
  163. ! .\"  $Header: /users/hugh/tmp/old_ae/ee.1,v 1.15 1993/03/29 04:23:12 hugh Exp $
  164.   .\"
  165. + .\"
  166.   .TH ee 1 "" "" "" ""
  167.   .SH NAME
  168.   ee \- easy editor
  169. ***************
  170. *** 57,65 ****
  171.   performance on some terminals).
  172.   .br
  173.   .\"
  174. ! .\"     command summary
  175.   .\"
  176. ! .SS Command Summary
  177.   To do anything other than insert text, the user must use the control 
  178.   keys (the 
  179.   .B Control 
  180. --- 58,66 ----
  181.   performance on some terminals).
  182.   .br
  183.   .\"
  184. ! .\"     control keys
  185.   .\"
  186. ! .SS "Control keys"
  187.   To do anything other than insert text, the user must use the control 
  188.   keys (the 
  189.   .B Control 
  190. ***************
  191. *** 77,88 ****
  192.   or 
  193.   .BR ^u .
  194.   .RS 4
  195. - .PP
  196. - .\"
  197. - .\"     control keys
  198. - .\"
  199. - .SS Control keys
  200. - .PP
  201.   .nf
  202.   .ta 1.4i
  203.   .sp
  204. --- 78,83 ----
  205. ***************
  206. *** 110,124 ****
  207.   ^x     Search.
  208.   ^y     Delete from the cursor position to the end of line.
  209.   ^z     Undelete the last deleted line.
  210. ! ^[ (\s-1ESC\s+1)    Pop up menu.
  211.   .RE
  212.   .ta
  213.   .fi
  214.   .sp
  215.   .\"
  216.   .\"     function keys
  217.   .\"
  218. ! .SS Function Keys
  219.   .RS 4
  220.   .IP "\fBNext Page\fR"
  221.   Move to the next page.
  222. --- 105,157 ----
  223.   ^x     Search.
  224.   ^y     Delete from the cursor position to the end of line.
  225.   ^z     Undelete the last deleted line.
  226. ! ^[ (ESC)    Pop up menu.
  227. ! .ta
  228. ! .fi
  229.   .RE
  230. + .sp
  231. + .SS "EMACS keys mode"
  232. + .PP
  233. + Since many shells provide an Emacs mode (for cursor movement and other editing 
  234. + operations), some bindings that may be more useful for people familiar with 
  235. + those bindings have been provided.  These are accessible via the 
  236. + .B settings 
  237. + menu, or via the initialization file (see below).  The mappings are as follows:
  238. + .RS
  239. + .nf
  240. + .ta 1.4i
  241. + ^a    Move to the beginning of the line.
  242. + ^b    Back 1 character.
  243. + ^c    Command prompt.
  244. + ^d    Delete character the cursor is sitting on.
  245. + ^e    End of line.
  246. + ^f    Forward 1 character.
  247. + ^g    Go back 1 page.
  248. + ^h    Backspace.
  249. + ^i    Tab.
  250. + ^j    Undelete last deleted character.
  251. + ^k    Delete line.
  252. + ^l    Undelete last deleted line.
  253. + ^m    Insert a newline.
  254. + ^n    Move to the next line.
  255. + ^o    Prompt for the decimal value of a character to insert.
  256. + ^p    Previous line.
  257. + ^r    Restore last deleted word.
  258. + ^t    Move to the top of the text.
  259. + ^u    Move to the bottom of the text.
  260. + ^v    Move to the next page.
  261. + ^w    Delete the word begining at the cursor position.
  262. + ^y    Prompt for the string to search for.
  263. + ^z    Next word.
  264. + ^[ (ESC)    Pop up menu.
  265.   .ta
  266.   .fi
  267. + .RE
  268.   .sp
  269.   .\"
  270.   .\"     function keys
  271.   .\"
  272. ! .SS "Function Keys"
  273.   .RS 4
  274.   .IP "\fBNext Page\fR"
  275.   Move to the next page.
  276. ***************
  277. *** 166,172 ****
  278.   .IP "\fBnocase\fR
  279.   Make searches insensitive to case (the default).
  280.   .IP "\fBnoexpand\fR"
  281. ! Don't expand tab to spaces when the \s-1TAB\s+1 key is pressed.
  282.   .IP "\fBquit\fR"
  283.   Leave the editor without saving changes.
  284.   .IP "\fBread\fR \fIfile\fR"
  285. --- 199,205 ----
  286.   .IP "\fBnocase\fR
  287.   Make searches insensitive to case (the default).
  288.   .IP "\fBnoexpand\fR"
  289. ! Don't expand tab to spaces when the TAB key is pressed.
  290.   .IP "\fBquit\fR"
  291.   Leave the editor without saving changes.
  292.   .IP "\fBread\fR \fIfile\fR"
  293. ***************
  294. *** 177,183 ****
  295.   .\"
  296.   .\"     menu options
  297.   .\"
  298. ! .SS Menu Operations
  299.   .PP
  300.   Pop-up menus can be obtained by pressing the 
  301.   .B escape 
  302. --- 210,216 ----
  303.   .\"
  304.   .\"     menu options
  305.   .\"
  306. ! .SS "Menu Operations"
  307.   .PP
  308.   Pop-up menus can be obtained by pressing the 
  309.   .B escape 
  310. ***************
  311. *** 225,231 ****
  312.   .\"
  313.   .\"     paragraph formatting
  314.   .\"
  315. ! .SS Paragraph Formatting
  316.   .PP
  317.   Paragraphs are defined for \fIee\fR by a block of text bounded by:
  318.   .sp 
  319. --- 258,264 ----
  320.   .\"
  321.   .\"     paragraph formatting
  322.   .\"
  323. ! .SS "Paragraph Formatting"
  324.   .PP
  325.   Paragraphs are defined for \fIee\fR by a block of text bounded by:
  326.   .sp 
  327. ***************
  328. *** 284,289 ****
  329. --- 317,324 ----
  330.   .IP "\fBinfo window\fR"
  331.   A window showing the keyboard operations that can be performed can be 
  332.   displayed or not.
  333. + .IP"\fBemacs keys\fR"
  334. + Control keys may be given bindings similar to emacs, or not.
  335.   .RE
  336.   .PP
  337.   You may set these modes via the initialization file (see below), or with a 
  338. ***************
  339. *** 291,297 ****
  340.   .\"
  341.   .\"     spell checking
  342.   .\"
  343. ! .SS Spell Checking
  344.   .PP
  345.   There are two ways to have the spelling in the text checked from \fIee\fR.  
  346.   One is by the traditional \fIspell\fR(1) command, the other is with the 
  347. --- 326,332 ----
  348.   .\"
  349.   .\"     spell checking
  350.   .\"
  351. ! .SS "Spell Checking"
  352.   .PP
  353.   There are two ways to have the spelling in the text checked from \fIee\fR.  
  354.   One is by the traditional \fIspell\fR(1) command, the other is with the 
  355. ***************
  356. *** 304,310 ****
  357.   .\"
  358.   .\"     printing
  359.   .\"
  360. ! .SS Printing the contents of the editor
  361.   .PP
  362.   The user may select a menu item which prints the contents of the editor.  
  363.   .I ee
  364. --- 339,345 ----
  365.   .\"
  366.   .\"     printing
  367.   .\"
  368. ! .SS "Printing the contents of the editor"
  369.   .PP
  370.   The user may select a menu item which prints the contents of the editor.  
  371.   .I ee
  372. ***************
  373. *** 322,328 ****
  374.   .\"
  375.   .\"     shell operations
  376.   .\"
  377. ! .SS Shell operations
  378.   .PP
  379.   Shell commands can be executed from within 
  380.   .I ee 
  381. --- 357,363 ----
  382.   .\"
  383.   .\"     shell operations
  384.   .\"
  385. ! .SS "Shell operations"
  386.   .PP
  387.   Shell commands can be executed from within 
  388.   .I ee 
  389. ***************
  390. *** 354,360 ****
  391.   .\"
  392.   .\"     initializing ee from a file
  393.   .\"
  394. ! .SS Initializing ee from a file
  395.   .PP
  396.   Since different users have different preferences, \fIee\fR allows some 
  397.   slight configurability.  There are three possible locations for an 
  398. --- 389,395 ----
  399.   .\"
  400.   .\"     initializing ee from a file
  401.   .\"
  402. ! .SS "Initializing ee from a file"
  403.   .PP
  404.   Since different users have different preferences, \fIee\fR allows some 
  405.   slight configurability.  There are three possible locations for an 
  406. ***************
  407. *** 411,416 ****
  408. --- 446,455 ----
  409.   .IP \fBnoeightbit\fR
  410.   Turns off display of eight bit characters (they are displayed as their decimal 
  411.   value inside angle brackets, e.g., "<220>").
  412. + .IP \fBemacs\fR
  413. + Turns on emacs key bindings.
  414. + .IP \fBnoemacs\fR
  415. + Turns off emacs key bindings.
  416.   .RE
  417.   .SH CAVEATS
  418.   .PP
  419. ***************
  420. *** 436,442 ****
  421.   .PP
  422.   Always make a copy of files that cannot be easily reproduced before 
  423.   editing.  Save files early, and save often.
  424. ! .SS International Code Set Support
  425.   .I ee 
  426.   supports single-byte character code sets (eight-bit clean).
  427.   .SH WARNINGS
  428. --- 475,481 ----
  429.   .PP
  430.   Always make a copy of files that cannot be easily reproduced before 
  431.   editing.  Save files early, and save often.
  432. ! .SS "International Code Set Support"
  433.   .I ee 
  434.   supports single-byte character code sets (eight-bit clean).
  435.   .SH WARNINGS
  436. ***************
  437. *** 460,466 ****
  438.   copyright.  All rights are reserved. 
  439.   .PP
  440.   Copyright (c) 1990, 1991, 1992, 1993 Hugh Mahon.
  441. ! .SH SEE ALSO
  442.   .PP
  443. ! terminfo(4), environ(5), spell(1), ispell(1), lp(1)
  444.   
  445. --- 499,505 ----
  446.   copyright.  All rights are reserved. 
  447.   .PP
  448.   Copyright (c) 1990, 1991, 1992, 1993 Hugh Mahon.
  449. ! .SH "SEE ALSO"
  450.   .PP
  451. ! termcap(4), terminfo(4), environ(5), spell(1), ispell(1), lp(1)
  452.   
  453. diff -cr ../ee-p1/ee.c ./ee.c
  454. *** ../ee-p1/ee.c    Sun Jul 11 19:52:09 1993
  455. --- ./ee.c    Sun Jul 11 19:49:47 1993
  456. ***************
  457. *** 51,57 ****
  458.    |    proprietary information which is protected by
  459.    |    copyright.  All rights are reserved.
  460.    |
  461. !  |    $Header: /users/hugh/tmp/old_ae/ee.c,v 1.66 1993/02/28 01:00:54 hugh Exp $
  462.    |
  463.    */
  464.   
  465. --- 51,57 ----
  466.    |    proprietary information which is protected by
  467.    |    copyright.  All rights are reserved.
  468.    |
  469. !  |    $Header: /users/hugh/tmp/old_ae/ee.c,v 1.67 1993/03/29 04:05:34 hugh Exp $
  470.    |
  471.    */
  472.   
  473. ***************
  474. *** 64,70 ****
  475.       "copyright.  All rights are reserved."
  476.       };
  477.   
  478. ! char *version = "@(#) ee, version 1.2.2 pl 1 $Revision: 1.66 $";
  479.   
  480.   #ifdef NCURSE
  481.   #include "new_curse.h"
  482. --- 64,70 ----
  483.       "copyright.  All rights are reserved."
  484.       };
  485.   
  486. ! char *version = "@(#) ee, version 1.2.2 pl 2 $Revision: 1.67 $";
  487.   
  488.   #ifdef NCURSE
  489.   #include "new_curse.h"
  490. ***************
  491. *** 172,177 ****
  492. --- 172,181 ----
  493.   int restricted = FALSE;        /* flag to indicate restricted mode    */
  494.   int nohighlight = FALSE;    /* turns off highlighting        */
  495.   int eightbit = TRUE;        /* eight bit character flag        */
  496. + int local_LINES = 0;        /* copy of LINES, to detect when win resizes */
  497. + int local_COLS = 0;        /* copy of COLS, to detect when win resizes  */
  498. + int curses_initialized = FALSE;    /* flag indicating if curses has been started*/
  499. + int emacs_keys_mode = FALSE;    /* mode for if emacs key binings are used    */
  500.   
  501.   char *point;            /* points to current position in line    */
  502.   char *srch_str;            /* pointer for search string        */
  503. ***************
  504. *** 256,274 ****
  505.   
  506.   struct menu_entries modes_menu[] = {
  507.       {"", NULL, NULL}, 
  508. !     {"                                                                      ", NULL, -1}, 
  509. !     {"                                                                      ", NULL, -1}, 
  510. !     {"                                                                      ", NULL, -1}, 
  511. !     {"                                                                      ", NULL, -1}, 
  512. !     {"                                                                      ", NULL, -1}, 
  513. !     {"                                                                      ", NULL, -1}, 
  514. !     {"                                                                      ", NULL, -1}, 
  515.       {NULL, NULL, -1}
  516.       };
  517.   
  518. ! int modes_initialized = FALSE;
  519.   
  520. ! char *mode_strings[8]; 
  521.   
  522.   struct menu_entries leave_menu[] = {
  523.       {"", NULL, -1}, 
  524. --- 260,279 ----
  525.   
  526.   struct menu_entries modes_menu[] = {
  527.       {"", NULL, NULL}, 
  528. !     {"", NULL, -1}, 
  529. !     {"", NULL, -1}, 
  530. !     {"", NULL, -1}, 
  531. !     {"", NULL, -1}, 
  532. !     {"", NULL, -1}, 
  533. !     {"", NULL, -1}, 
  534. !     {"", NULL, -1}, 
  535. !     {"", NULL, -1}, 
  536.       {NULL, NULL, -1}
  537.       };
  538.   
  539. ! char *mode_strings[9]; 
  540.   
  541. ! #define NUM_MODES_ITEMS 9
  542.   
  543.   struct menu_entries leave_menu[] = {
  544.       {"", NULL, -1}, 
  545. ***************
  546. *** 325,338 ****
  547.       };
  548.   
  549.   char *help_text[22];
  550.   char *control_keys[5];
  551.   
  552.   char *command_strings[5];
  553.   char *commands[30];
  554. ! char *init_strings[18];
  555.   
  556. ! int abort();
  557.   
  558.   /*
  559.    |    Declarations for strings for localization
  560. --- 330,345 ----
  561.       };
  562.   
  563.   char *help_text[22];
  564.   char *control_keys[5];
  565.   
  566. + char *emacs_help_text[22];
  567. + char *emacs_control_keys[5];
  568.   char *command_strings[5];
  569.   char *commands[30];
  570. ! char *init_strings[20];
  571.   
  572. ! int edit_abort();
  573.   
  574.   /*
  575.    |    Declarations for strings for localization
  576. ***************
  577. *** 416,421 ****
  578. --- 423,430 ----
  579.   char *NOHIGHLIGHT;
  580.   char *EIGHTBIT;
  581.   char *NOEIGHTBIT;
  582. + char *EMACS_string;
  583. + char *NOEMACS_string;
  584.   
  585.   main(argc, argv)        /* beginning of main program        */
  586.   int argc;
  587. ***************
  588. *** 428,434 ****
  589.   
  590.       signal(SIGCHLD, SIG_DFL);
  591.       signal(SIGSEGV, SIG_DFL);
  592. !     signal(SIGINT, abort);
  593.   
  594.       d_char = 0;
  595.       d_word = malloc(150);
  596. --- 437,443 ----
  597.   
  598.       signal(SIGCHLD, SIG_DFL);
  599.       signal(SIGSEGV, SIG_DFL);
  600. !     signal(SIGINT, edit_abort);
  601.   
  602.       d_char = 0;
  603.       d_word = malloc(150);
  604. ***************
  605. *** 477,482 ****
  606. --- 486,493 ----
  607.           if (in == -1)
  608.               exit(0);
  609.   
  610. +         resize_check();
  611.           if (clear_com_win)
  612.           {
  613.               clear_com_win = FALSE;
  614. ***************
  615. *** 496,502 ****
  616.           else if ((in > 31) || (in == 9))
  617.               insert(in);
  618.           else if ((in >= 0) && (in <= 31))
  619. !             control();
  620.       }
  621.   }
  622.   
  623. --- 507,518 ----
  624.           else if ((in > 31) || (in == 9))
  625.               insert(in);
  626.           else if ((in >= 0) && (in <= 31))
  627. !         {
  628. !             if (emacs_keys_mode)
  629. !                 emacs_control();
  630. !             else
  631. !                 control();
  632. !         }
  633.       }
  634.   }
  635.   
  636. ***************
  637. *** 1052,1057 ****
  638. --- 1068,1150 ----
  639.       }    
  640.   }
  641.   
  642. + /*
  643. +  |    Emacs control-key bindings
  644. +  */
  645. + emacs_control()
  646. + {
  647. +     char *string;
  648. +     if (in == 1)        /* control a    */
  649. +         bol();
  650. +     else if (in == 2)    /* control b    */
  651. +         left(TRUE);
  652. +     else if (in == 3)    /* control c    */
  653. +     {
  654. +         command_prompt();
  655. +     }
  656. +     else if (in == 4)    /* control d    */
  657. +         del_char();
  658. +     else if (in == 5)    /* control e    */
  659. +         eol();
  660. +     else if (in == 6)    /* control f    */
  661. +         right(TRUE);
  662. +     else if (in == 7)    /* control g    */
  663. +         move_rel("u", max(5, (last_line - 5)));
  664. +     else if (in == 8)    /* control h    */
  665. +         delete(TRUE);
  666. +     else if (in == 9)    /* control i    */
  667. +         ;
  668. +     else if (in == 10)    /* control j    */
  669. +         undel_char();
  670. +     else if (in == 11)    /* control k    */
  671. +         del_line();
  672. +     else if (in == 12)    /* control l    */
  673. +         undel_line();
  674. +     else if (in == 13)    /* control m    */
  675. +         insert_line(TRUE);
  676. +     else if (in == 14)    /* control n    */
  677. +         down();
  678. +     else if (in == 15)    /* control o    */
  679. +     {
  680. +         string = get_string(ascii_code_str, TRUE);
  681. +         if (*string != NULL)
  682. +         {
  683. +             in = atoi(string);
  684. +             wmove(text_win, scr_vert, (scr_horz - horiz_offset));
  685. +             insert(in);
  686. +         }
  687. +         free(string);
  688. +     }
  689. +     else if (in == 16)    /* control p    */
  690. +         up();
  691. +     else if (in == 17)    /* control q    */
  692. +         ;
  693. +     else if (in == 18)    /* control r    */
  694. +         undel_word();
  695. +     else if (in == 19)    /* control s    */
  696. +         ;
  697. +     else if (in == 20)    /* control t    */
  698. +         top();
  699. +     else if (in == 21)    /* control u    */
  700. +         bottom();
  701. +     else if (in == 22)    /* control v    */
  702. +         move_rel("d", max(5, (last_line - 5)));
  703. +     else if (in == 23)    /* control w    */
  704. +         del_word();
  705. +     else if (in == 24)    /* control x    */
  706. +         search(TRUE);
  707. +     else if (in == 25)    /* control y    */
  708. +         search_prompt();
  709. +     else if (in == 26)    /* control z    */
  710. +         adv_word();
  711. +     else if (in == 27)    /* control [ (escape)    */
  712. +     {
  713. +         menu_op(main_menu);
  714. +     }    
  715. + }
  716.   bottom()            /* go to bottom of file            */
  717.   {
  718.       while (curr_line->next_line != NULL)
  719. ***************
  720. *** 1423,1429 ****
  721.       {
  722.           wmove(com_win, 0, 0);
  723.           wclrtoeol(com_win);
  724. !         wprintw(com_win, current_file_str, in_file_name);
  725.       }
  726.       else if ((*cmd_str >= '0') && (*cmd_str <= '9'))
  727.           goto_line(cmd_str);
  728. --- 1516,1525 ----
  729.       {
  730.           wmove(com_win, 0, 0);
  731.           wclrtoeol(com_win);
  732. !         if (in_file_name == NULL)
  733. !             wprintw(com_win, no_file_string);
  734. !         else
  735. !             wprintw(com_win, current_file_str, in_file_name);
  736.       }
  737.       else if ((*cmd_str >= '0') && (*cmd_str <= '9'))
  738.           goto_line(cmd_str);
  739. ***************
  740. *** 2085,2091 ****
  741.       }
  742.   }
  743.   
  744. ! abort()
  745.   {
  746.       wrefresh(com_win);
  747.       resetty();
  748. --- 2181,2187 ----
  749.       }
  750.   }
  751.   
  752. ! edit_abort()
  753.   {
  754.       wrefresh(com_win);
  755.       resetty();
  756. ***************
  757. *** 2655,2669 ****
  758.           else
  759.               temp_point++;
  760.       }
  761. -     keypad(com_win, FALSE);
  762. -     keypad(text_win, FALSE);
  763. -     echo();
  764. -     noraw();
  765. -     resetty();
  766.   
  767.   #ifndef NCURSE
  768. !     endwin();
  769.   #endif
  770.   
  771.       if (in_pipe)
  772.       {
  773. --- 2751,2775 ----
  774.           else
  775.               temp_point++;
  776.       }
  777.   
  778. +     /*
  779. +      |    if in_pipe is true, then output of the shell operation will be 
  780. +      |    read by the editor, and curses doesn't need to be turned off
  781. +      */
  782. +     if (!in_pipe)
  783. +     {
  784. +         keypad(com_win, FALSE);
  785. +         keypad(text_win, FALSE);
  786. +         echo();
  787. +         nl();
  788. +         noraw();
  789. +         resetty();
  790.   #ifndef NCURSE
  791. !         endwin();
  792.   #endif
  793. +     }
  794.   
  795.       if (in_pipe)
  796.       {
  797. ***************
  798. *** 2789,2795 ****
  799.               if (!shell_fork)
  800.                   exit(0);
  801.           }
  802. !         signal(SIGINT, abort);
  803.       }
  804.       if (shell_fork)
  805.       {
  806. --- 2895,2901 ----
  807.               if (!shell_fork)
  808.                   exit(0);
  809.           }
  810. !         signal(SIGINT, edit_abort);
  811.       }
  812.       if (shell_fork)
  813.       {
  814. ***************
  815. *** 2799,2815 ****
  816.               ;
  817.       }
  818.   
  819. ! #ifdef NCURSE
  820. !     fixterm();
  821. !     noecho();
  822. !     raw();
  823. !     keypad(text_win, TRUE);
  824. !     keypad(com_win, TRUE);
  825. !     if (info_window)
  826. !         clearok(info_win, TRUE);
  827. ! #else
  828. !     set_up_term();
  829. ! #endif
  830.   
  831.       redraw();
  832.   }
  833. --- 2905,2921 ----
  834.               ;
  835.       }
  836.   
  837. !     if (!in_pipe)
  838. !     {
  839. !         fixterm();
  840. !         noecho();
  841. !         nonl();
  842. !         raw();
  843. !         keypad(text_win, TRUE);
  844. !         keypad(com_win, TRUE);
  845. !         if (info_window)
  846. !             clearok(info_win, TRUE);
  847. !     }
  848.   
  849.       redraw();
  850.   }
  851. ***************
  852. *** 2816,2825 ****
  853.   
  854.   set_up_term()        /* set up the terminal for operating with ae    */
  855.   {
  856. !     initscr();
  857. !     savetty();
  858. !     noecho();
  859. !     raw();
  860.   
  861.       if (((LINES > 15) && (COLS >= 80)) && info_window)
  862.           last_line = LINES - 8;
  863. --- 2922,2936 ----
  864.   
  865.   set_up_term()        /* set up the terminal for operating with ae    */
  866.   {
  867. !     if (!curses_initialized)
  868. !     {
  869. !         initscr();
  870. !         savetty();
  871. !         noecho();
  872. !         raw();
  873. !         nonl();
  874. !         curses_initialized = TRUE;
  875. !     }
  876.   
  877.       if (((LINES > 15) && (COLS >= 80)) && info_window)
  878.           last_line = LINES - 8;
  879. ***************
  880. *** 2853,2860 ****
  881. --- 2964,2988 ----
  882.       }
  883.   
  884.       last_col = COLS - 1;
  885. +     local_LINES = LINES;
  886. +     local_COLS = COLS;
  887.   }
  888.   
  889. + resize_check()
  890. + {
  891. +     if ((LINES == local_LINES) && (COLS == local_COLS))
  892. +         return;
  893. +     if (info_window)
  894. +         delwin(info_win);
  895. +     delwin(text_win);
  896. +     delwin(com_win);
  897. +     delwin(help_win);
  898. +     set_up_term();
  899. +     redraw();
  900. +     wrefresh(text_win);
  901. + }
  902.   menu_op(menu_list)
  903.   struct menu_entries menu_list[];
  904.   {
  905. ***************
  906. *** 3025,3031 ****
  907.       for (counter = 0; counter < 22; counter++)
  908.       {
  909.           wmove(help_win, counter, 0);
  910. !         wprintw(help_win, "%s", help_text[counter]);
  911.       }
  912.       wrefresh(help_win);
  913.       werase(com_win);
  914. --- 3153,3160 ----
  915.       for (counter = 0; counter < 22; counter++)
  916.       {
  917.           wmove(help_win, counter, 0);
  918. !         waddstr(help_win, (emacs_keys_mode) ? 
  919. !             emacs_help_text[counter] : help_text[counter]);
  920.       }
  921.       wrefresh(help_win);
  922.       werase(com_win);
  923. ***************
  924. *** 3056,3062 ****
  925.           wmove(info_win, counter, 0);
  926.           wclrtoeol(info_win);
  927.           if (info_type == CONTROL_KEYS)
  928. !             waddstr(info_win, control_keys[counter]);
  929.           else if (info_type == COMMANDS)
  930.               waddstr(info_win, command_strings[counter]);
  931.       }
  932. --- 3185,3192 ----
  933.           wmove(info_win, counter, 0);
  934.           wclrtoeol(info_win);
  935.           if (info_type == CONTROL_KEYS)
  936. !             waddstr(info_win, (emacs_keys_mode) ? 
  937. !               emacs_control_keys[counter] : control_keys[counter]);
  938.           else if (info_type == COMMANDS)
  939.               waddstr(info_win, command_strings[counter]);
  940.       }
  941. ***************
  942. *** 3095,3101 ****
  943.       keypad(text_win, TRUE);
  944.       idlok(text_win, TRUE);
  945.       werase(text_win);
  946. -     wrefresh(text_win);
  947.       info_window = TRUE;
  948.       info_win = newwin(6, COLS, 0, 0);
  949.       werase(info_win);
  950. --- 3225,3230 ----
  951. ***************
  952. *** 3103,3108 ****
  953. --- 3232,3238 ----
  954.       midscreen(min(scr_vert, last_line), point);
  955.       clearok(info_win, TRUE);
  956.       paint_info_win();
  957. +     wrefresh(text_win);
  958.       clear_com_win = TRUE;
  959.   }
  960.   
  961. ***************
  962. *** 3553,3558 ****
  963. --- 3683,3692 ----
  964.                       eightbit = TRUE;
  965.                   else if (compare(str1, NOEIGHTBIT, FALSE))
  966.                       eightbit = FALSE;
  967. +                 else if (compare(str1, EMACS_string, FALSE))
  968. +                     emacs_keys_mode = TRUE;
  969. +                 else if (compare(str1, NOEMACS_string, FALSE))
  970. +                     emacs_keys_mode = FALSE;
  971.               }
  972.               fclose(init_file);
  973.           }
  974. ***************
  975. *** 3934,3940 ****
  976.                       (eightbit ? ON : OFF));
  977.           sprintf(modes_menu[6].item_string, "%s %s", mode_strings[6], 
  978.                       (info_window ? ON : OFF));
  979. !         sprintf(modes_menu[7].item_string, "%s %d", mode_strings[7], 
  980.                       right_margin);
  981.   
  982.           ret_value = menu_op(modes_menu);
  983. --- 4068,4076 ----
  984.                       (eightbit ? ON : OFF));
  985.           sprintf(modes_menu[6].item_string, "%s %s", mode_strings[6], 
  986.                       (info_window ? ON : OFF));
  987. !         sprintf(modes_menu[7].item_string, "%s %s", mode_strings[7], 
  988. !                     (emacs_keys_mode ? ON : OFF));
  989. !         sprintf(modes_menu[8].item_string, "%s %d", mode_strings[8], 
  990.                       right_margin);
  991.   
  992.           ret_value = menu_op(modes_menu);
  993. ***************
  994. *** 3967,3972 ****
  995. --- 4103,4113 ----
  996.                       create_info_window();
  997.                   break;
  998.               case 7:
  999. +                 emacs_keys_mode = !emacs_keys_mode;
  1000. +                 if (info_window)
  1001. +                     paint_info_win();
  1002. +                 break;
  1003. +             case 8:
  1004.                   string = get_string(margin_prompt, TRUE);
  1005.                   if (string != NULL)
  1006.                   {
  1007. ***************
  1008. *** 4101,4106 ****
  1009. --- 4242,4249 ----
  1010.   
  1011.   strings_init()
  1012.   {
  1013. +     int counter;
  1014.   #ifndef NO_CATGETS
  1015.       setlocale(LC_ALL, "");
  1016.       catalog = catopen("ee", 0);
  1017. ***************
  1018. *** 4113,4119 ****
  1019.       mode_strings[4]  = catgetlocal( 5, "auto-paragraph format"); 
  1020.       mode_strings[5]  = catgetlocal( 6, "eightbit characters  "); 
  1021.       mode_strings[6]  = catgetlocal( 7, "info window          "); 
  1022. !     mode_strings[7]  = catgetlocal( 8, "right margin         ");
  1023.       leave_menu[0].item_string  = catgetlocal( 9, "leave menu");
  1024.       leave_menu[1].item_string  = catgetlocal( 10, "save changes");
  1025.       leave_menu[2].item_string  = catgetlocal( 11, "no save");
  1026. --- 4256,4262 ----
  1027.       mode_strings[4]  = catgetlocal( 5, "auto-paragraph format"); 
  1028.       mode_strings[5]  = catgetlocal( 6, "eightbit characters  "); 
  1029.       mode_strings[6]  = catgetlocal( 7, "info window          "); 
  1030. !     mode_strings[8]  = catgetlocal( 8, "right margin         ");
  1031.       leave_menu[0].item_string  = catgetlocal( 9, "leave menu");
  1032.       leave_menu[1].item_string  = catgetlocal( 10, "save changes");
  1033.       leave_menu[2].item_string  = catgetlocal( 11, "no save");
  1034. ***************
  1035. *** 4250,4255 ****
  1036. --- 4393,4432 ----
  1037.       NOHIGHLIGHT = catgetlocal( 142, "NOHIGHLIGHT");
  1038.       EIGHTBIT = catgetlocal( 143, "EIGHTBIT");
  1039.       NOEIGHTBIT = catgetlocal( 144, "NOEIGHTBIT");
  1040. +     /*
  1041. +      |    additions
  1042. +      */
  1043. +     mode_strings[7] = catgetlocal( 145, "emacs key bindings   ");
  1044. +     emacs_help_text[0] = help_text[0];
  1045. +     emacs_help_text[1] = catgetlocal( 146, "^a beginning of line    ^i tab                  ^r restore word            ");
  1046. +     emacs_help_text[2] = catgetlocal( 147, "^b back 1 char          ^j undel char           ^t top of text             ");
  1047. +     emacs_help_text[3] = catgetlocal( 148, "^c command              ^k delete line          ^u bottom of text          ");
  1048. +     emacs_help_text[4] = catgetlocal( 149, "^d delete char          ^l undelete line        ^v next page               ");
  1049. +     emacs_help_text[5] = catgetlocal( 150, "^e end of line          ^m newline              ^w delete word             ");
  1050. +     emacs_help_text[6] = catgetlocal( 151, "^f forward 1 char       ^n next line            ^x search                  ");
  1051. +     emacs_help_text[7] = catgetlocal( 152, "^g go back 1 page       ^o ascii char insert    ^y search prompt           ");
  1052. +     emacs_help_text[8] = catgetlocal( 153, "^h backspace            ^p prev line            ^z next word               ");
  1053. +     emacs_help_text[9] = help_text[9];
  1054. +     emacs_help_text[10] = help_text[10];
  1055. +     emacs_help_text[11] = help_text[11];
  1056. +     emacs_help_text[12] = help_text[12];
  1057. +     emacs_help_text[13] = help_text[13];
  1058. +     emacs_help_text[14] = help_text[14];
  1059. +     emacs_help_text[15] = help_text[15];
  1060. +     emacs_help_text[16] = help_text[16];
  1061. +     emacs_help_text[17] = help_text[17];
  1062. +     emacs_help_text[18] = help_text[18];
  1063. +     emacs_help_text[19] = help_text[19];
  1064. +     emacs_help_text[20] = help_text[20];
  1065. +     emacs_help_text[21] = help_text[21];
  1066. +     emacs_control_keys[0] = catgetlocal( 154, "^[ (escape) menu  ^y search prompt  ^k delete line   ^p prev li   ^g prev page");
  1067. +     emacs_control_keys[1] = catgetlocal( 155, "^o ascii code     ^x search         ^l undelete line ^n next li   ^v next page");
  1068. +     emacs_control_keys[2] = catgetlocal( 156, "^u end of file    ^a begin of line  ^w delete word   ^b back 1 char           ");
  1069. +     emacs_control_keys[3] = catgetlocal( 157, "^t top of text    ^e end of line    ^r restore word  ^f forward 1 char        ");
  1070. +     emacs_control_keys[4] = catgetlocal( 158, "^c command        ^d delete char    ^j undelete char ^z next word              ");
  1071. +     EMACS_string = catgetlocal( 159, "EMACS");
  1072. +     NOEMACS_string = catgetlocal( 160, "NOEMACS");
  1073.       commands[0] = HELP;
  1074.       commands[1] = WRITE;
  1075.       commands[2] = READ;
  1076. ***************
  1077. *** 4297,4303 ****
  1078.       init_strings[14] = NOHIGHLIGHT;
  1079.       init_strings[15] = EIGHTBIT;
  1080.       init_strings[16] = NOEIGHTBIT;
  1081. !     init_strings[17] = NULL;
  1082.   
  1083.   #ifndef NO_CATGETS
  1084.       catclose(catalog);
  1085. --- 4474,4491 ----
  1086.       init_strings[14] = NOHIGHLIGHT;
  1087.       init_strings[15] = EIGHTBIT;
  1088.       init_strings[16] = NOEIGHTBIT;
  1089. !     init_strings[17] = EMACS_string;
  1090. !     init_strings[18] = NOEMACS_string;
  1091. !     init_strings[19] = NULL;
  1092. !     /*
  1093. !      |    allocate space for strings here for settings menu
  1094. !      */
  1095. !     for (counter = 1; counter < NUM_MODES_ITEMS; counter++)
  1096. !     {
  1097. !         modes_menu[counter].item_string = malloc(80);
  1098. !     }
  1099.   
  1100.   #ifndef NO_CATGETS
  1101.       catclose(catalog);
  1102. diff -cr ../ee-p1/ee.i18n.guide ./ee.i18n.guide
  1103. *** ../ee-p1/ee.i18n.guide    Sun Jul 11 19:51:43 1993
  1104. --- ./ee.i18n.guide    Sun Jul 11 19:49:56 1993
  1105. ***************
  1106. *** 88,93 ****
  1107. --- 88,98 ----
  1108.   115        string indicating mode is turned 'off' in modes menu
  1109.   116 - 131    strings used for commands (some also used for initialization)
  1110.   132 - 144    strings used for initialization
  1111. + 145        entry for settings menu for emacs key bindings settings
  1112. + 146 - 153    help screen entries for emacs key bindings info
  1113. + 154 - 158    info window entries for emacs key bindings info
  1114. + 159        string for turning on emacs key bindings in the init file
  1115. + 160        string for turning off emacs key bindings in the init file
  1116.   
  1117.   Care should be taken when translating commands and initialization keywords 
  1118.   because the algorithm used for detecting uniqueness of entered commands 
  1119. diff -cr ../ee-p1/ee.msg ./ee.msg
  1120. *** ../ee-p1/ee.msg    Sun Jul 11 19:51:50 1993
  1121. --- ./ee.msg    Sun Jul 11 19:50:03 1993
  1122. ***************
  1123. *** 147,149 ****
  1124. --- 147,166 ----
  1125.   142 "NOHIGHLIGHT"
  1126.   143 "EIGHTBIT"
  1127.   144 "NOEIGHTBIT"
  1128. + 145 "emacs key bindings   "
  1129. + 146 "^a beginning of line    ^i tab                  ^r restore word            "
  1130. + 147 "^b back 1 char          ^j undel char           ^t top of text             "
  1131. + 148 "^c command              ^k delete line          ^u bottom of text          "
  1132. + 149 "^d delete char          ^l undelete line        ^v next page               "
  1133. + 150 "^e end of line          ^m newline              ^w delete word             "
  1134. + 151 "^f forward 1 char       ^n next line            ^x search                  "
  1135. + 152 "^g go back 1 page       ^o ascii char insert    ^y search prompt           "
  1136. + 153 "^h backspace            ^p prev line            ^z next word               "
  1137. + 154 "^[ (escape) menu  ^y search prompt  ^k delete line   ^p prev li   ^g prev page"
  1138. + 155 "^o ascii code     ^x search         ^l undelete line ^n next li   ^v next page"
  1139. + 156 "^u end of file    ^a begin of line  ^w delete word   ^b back 1 char           "
  1140. + 157 "^t top of text    ^e end of line    ^r restore word  ^f forward 1 char        "
  1141. + 158 "^c command        ^d delete char    ^j undelete char ^z next word              "
  1142. + 159 "EMACS"
  1143. + 160 "NOEMACS"
  1144. diff -cr ../ee-p1/new_curse.c ./new_curse.c
  1145. *** ../ee-p1/new_curse.c    Sun Jul 11 19:52:10 1993
  1146. --- ./new_curse.c    Sun Jul 11 19:50:11 1993
  1147. ***************
  1148. *** 39,55 ****
  1149.    |    Copyright (c) 1986, 1987, 1988, 1991, 1992 Hugh Mahon
  1150.    |    All are rights reserved.
  1151.    |
  1152. !  |    $Header: /users/hugh/tmp/old_ae/new_curse.c,v 1.21 1993/02/28 21:50:21 hugh Exp $
  1153.    |
  1154.    */
  1155.   
  1156.   #include "new_curse.h"
  1157.   #include <signal.h>
  1158.   
  1159.   char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992 Hugh Mahon",
  1160.                   "All rights are reserved."};
  1161.   
  1162. ! char * new_curse_name= "@(#) new_curse.c $Revision: 1.21 $";
  1163.   
  1164.   WINDOW *curscr;
  1165.   static WINDOW *virtual_scr;
  1166. --- 39,60 ----
  1167.    |    Copyright (c) 1986, 1987, 1988, 1991, 1992 Hugh Mahon
  1168.    |    All are rights reserved.
  1169.    |
  1170. !  |    $Header: /users/hugh/tmp/old_ae/new_curse.c,v 1.22 1993/03/29 04:10:29 hugh Exp $
  1171.    |
  1172.    */
  1173.   
  1174.   #include "new_curse.h"
  1175.   #include <signal.h>
  1176. + #include <fcntl.h>
  1177. + #ifdef BSD_SELECT
  1178. + #include <sys/types.h>
  1179. + #include <sys/time.h>
  1180. + #endif
  1181.   
  1182.   char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992 Hugh Mahon",
  1183.                   "All rights are reserved."};
  1184.   
  1185. ! char * new_curse_name= "@(#) new_curse.c $Revision: 1.22 $ pl 2";
  1186.   
  1187.   WINDOW *curscr;
  1188.   static WINDOW *virtual_scr;
  1189. ***************
  1190. *** 57,62 ****
  1191. --- 62,73 ----
  1192.   WINDOW *newwin();
  1193.   WINDOW *last_window_refreshed;
  1194.   
  1195. + #ifdef TIOCGWINSZ
  1196. +     struct winsize ws;
  1197. + #endif
  1198. + #define min(a, b)    (a < b ? a : b)
  1199.   #ifndef CAP
  1200.   #define String_Out(table, stack, place) Info_Out(table, stack, place)
  1201.   #else
  1202. ***************
  1203. *** 452,460 ****
  1204.   int Repaint_screen;    /* if an operation to change screen impossible, repaint screen    */
  1205.   int Intr;        /* storeage for interrupt character        */
  1206.   int Parity;        /* 0 = no parity, 1 = odd parity, 2 = even parity */
  1207. ! int Nowait;        /* for BSD systems                */
  1208.   int Num_bits;    /* number of bits per character    */
  1209.   int Flip_Bytes;    /* some systems have byte order reversed    */
  1210.   
  1211.   #ifndef CAP
  1212.   char *Strings;
  1213. --- 463,472 ----
  1214.   int Repaint_screen;    /* if an operation to change screen impossible, repaint screen    */
  1215.   int Intr;        /* storeage for interrupt character        */
  1216.   int Parity;        /* 0 = no parity, 1 = odd parity, 2 = even parity */
  1217. ! int Noblock;        /* for BSD systems                */
  1218.   int Num_bits;    /* number of bits per character    */
  1219.   int Flip_Bytes;    /* some systems have byte order reversed    */
  1220. + int interrupt_flag = FALSE;    /* set true if SIGWINCH received    */
  1221.   
  1222.   #ifndef CAP
  1223.   char *Strings;
  1224. ***************
  1225. *** 513,518 ****
  1226. --- 525,606 ----
  1227.   
  1228.   int *virtual_lines;
  1229.   
  1230. + #ifdef SIGWINCH
  1231. + /*
  1232. +  |    Copy the contents of one window to another.
  1233. +  */
  1234. + copy_window(origin, destination)
  1235. + WINDOW *origin, *destination;
  1236. + {
  1237. +     int counter, row, column;
  1238. +     struct _line *orig, *dest;
  1239. +     orig = origin->first_line;
  1240. +     dest = destination->first_line;
  1241. +     for (row = 0; 
  1242. +         row < (min(origin->Num_lines, destination->Num_lines)); 
  1243. +             row++)
  1244. +     {
  1245. +         for (column = 0; 
  1246. +             column < (min(origin->Num_cols, destination->Num_cols)); 
  1247. +             column++)
  1248. +         {
  1249. +             dest->row[column] = orig->row[column];
  1250. +             dest->attributes[column] = orig->attributes[column];
  1251. +         }
  1252. +         dest->changed = orig->changed;
  1253. +         dest->scroll = orig->scroll;
  1254. +         dest->last_char = min(orig->last_char, destination->Num_cols);
  1255. +         orig = orig->next_screen;
  1256. +         dest = dest->next_screen;
  1257. +     }
  1258. +     destination->LX = min((destination->Num_cols - 1), origin->LX);
  1259. +     destination->LY = min((destination->Num_lines - 1), origin->LY);
  1260. +     destination->Attrib = origin->Attrib;
  1261. +     destination->scroll_up = origin->scroll_up;
  1262. +     destination->scroll_down = origin->scroll_down;
  1263. +     destination->SCROLL_CLEAR = origin->SCROLL_CLEAR;
  1264. + }
  1265. + reinitscr() 
  1266. + {
  1267. +     WINDOW *local_virt;
  1268. +     WINDOW *local_std;
  1269. +     WINDOW *local_cur;
  1270. +     signal(SIGWINCH, reinitscr);
  1271. + #ifdef TIOCGWINSZ
  1272. +     if (ioctl(0, TIOCGWINSZ, &ws) < 0)
  1273. +     {
  1274. +         perror("TIOCGWINSZ");
  1275. +         exit(1);
  1276. +     }
  1277. +     if (ws.ws_row == LINES && ws.ws_col == COLS) 
  1278. +         return(0);
  1279. +     if (ws.ws_row > 0) LINES = ws.ws_row;
  1280. +     if (ws.ws_col > 0) COLS = ws.ws_col;
  1281. + #endif /* TIOCGWINSZ */
  1282. +     local_virt = newwin(LINES, COLS, 0, 0);
  1283. +     local_std = newwin(LINES, COLS, 0, 0);
  1284. +     local_cur = newwin(LINES, COLS, 0, 0);
  1285. +     copy_window(virtual_scr, local_virt);
  1286. +     copy_window(stdscr, local_std);
  1287. +     copy_window(curscr, local_cur);
  1288. +     delwin(virtual_scr);
  1289. +     delwin(stdscr);
  1290. +     delwin(curscr);
  1291. +     virtual_scr = local_virt;
  1292. +     stdscr = local_std;
  1293. +     curscr = local_cur;
  1294. +     free(virtual_lines);
  1295. +     virtual_lines = (int *) malloc(LINES * (sizeof(int)));
  1296. +     interrupt_flag = TRUE;
  1297. + }
  1298. + #endif /* SIGWINCH */
  1299.   initscr()        /* initialize terminal for operations    */
  1300.   {
  1301.       char *pointer;
  1302. ***************
  1303. *** 525,536 ****
  1304.   #endif
  1305.       if (initialized)
  1306.           return;
  1307.       Flip_Bytes = FALSE;
  1308.       Parity = 0;
  1309.       Time_Out = FALSE;
  1310.       bufp = 0;
  1311.       Move_It = FALSE;
  1312. !     Nowait = FALSE;
  1313.   #ifdef SYS5
  1314.       value = ioctl(0, TCGETA, &Terminal);
  1315.       if (Terminal.c_cflag & PARENB)
  1316. --- 613,627 ----
  1317.   #endif
  1318.       if (initialized)
  1319.           return;
  1320. + #ifdef BSD_SELECT
  1321. +     setbuf(stdin, NULL);
  1322. + #endif /* BSD_SELECT */
  1323.       Flip_Bytes = FALSE;
  1324.       Parity = 0;
  1325.       Time_Out = FALSE;
  1326.       bufp = 0;
  1327.       Move_It = FALSE;
  1328. !     Noblock = FALSE;
  1329.   #ifdef SYS5
  1330.       value = ioctl(0, TCGETA, &Terminal);
  1331.       if (Terminal.c_cflag & PARENB)
  1332. ***************
  1333. *** 635,665 ****
  1334.           exit(0);
  1335.       }
  1336.   #ifndef CAP
  1337.       TERM_PATH = getenv("TERMINFO");
  1338.       if (TERM_PATH != NULL)
  1339.       {
  1340.           Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
  1341. !         pointer = Term_File_name = malloc(Data_Line_len);
  1342. !         strcpy(Term_File_name, TERM_PATH);
  1343. !         while (*pointer != NULL)
  1344. !             pointer++;
  1345. !         *pointer = '/';
  1346. !         pointer++;
  1347.       }
  1348. !     else
  1349.       {
  1350. !         pointer = Term_File_name = malloc(22 + strlen(TERMINAL_TYPE));
  1351. !         strcpy(Term_File_name, "/usr/lib/terminfo/");
  1352. !         while (*pointer != NULL)
  1353. !             pointer++;
  1354.       }
  1355. !     *pointer = *TERMINAL_TYPE;
  1356. !     pointer++;
  1357. !     *pointer = '/';
  1358. !     pointer++;
  1359. !     strcpy(pointer, TERMINAL_TYPE);
  1360. !     if ((Fildes = open(Term_File_name, 0)) == -1)
  1361.       {
  1362.           free(Term_File_name);
  1363.           Term_File_name = NULL;
  1364.       }
  1365. --- 726,758 ----
  1366.           exit(0);
  1367.       }
  1368.   #ifndef CAP
  1369. +     Fildes = -1;
  1370.       TERM_PATH = getenv("TERMINFO");
  1371.       if (TERM_PATH != NULL)
  1372.       {
  1373.           Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
  1374. !         Term_File_name = malloc(Data_Line_len);
  1375. !         sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
  1376. !         Fildes = open(Term_File_name, O_RDONLY);
  1377.       }
  1378. !     if (Fildes == -1)
  1379.       {
  1380. !         TERM_PATH = "/usr/lib/terminfo";
  1381. !         Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
  1382. !         Term_File_name = malloc(Data_Line_len);
  1383. !         sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
  1384. !         Fildes = open(Term_File_name, O_RDONLY);
  1385.       }
  1386. !     if (Fildes == -1)
  1387.       {
  1388. +         TERM_PATH = "/usr/share/lib/terminfo";
  1389. +         Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
  1390. +         Term_File_name = malloc(Data_Line_len);
  1391. +         sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
  1392. +         Fildes = open(Term_File_name, O_RDONLY);
  1393. +     }
  1394. +     if (Fildes == -1)
  1395. +     {
  1396.           free(Term_File_name);
  1397.           Term_File_name = NULL;
  1398.       }
  1399. ***************
  1400. *** 666,672 ****
  1401.       else
  1402.           TERM_INFO = INFO_PARSE();
  1403.   #else
  1404. !     Term_File_name = "/etc/termcap";
  1405.       if ((TFP = fopen(Term_File_name, "r")) == NULL)
  1406.       {
  1407.           printf("unable to open /etc/termcap file \n");
  1408. --- 759,777 ----
  1409.       else
  1410.           TERM_INFO = INFO_PARSE();
  1411.   #else
  1412. !     /*
  1413. !      |    termcap information can be in the TERMCAP env variable, if so 
  1414. !      |    use that, otherwise check the /etc/termcap file
  1415. !      */
  1416. !     if ((pointer = Term_File_name = getenv("TERMCAP")) != NULL)
  1417. !     {
  1418. !         if (*Term_File_name != '/')
  1419. !             Term_File_name = "/etc/termcap";
  1420. !     }
  1421. !     else
  1422. !     {
  1423. !         Term_File_name = "/etc/termcap";
  1424. !     }
  1425.       if ((TFP = fopen(Term_File_name, "r")) == NULL)
  1426.       {
  1427.           printf("unable to open /etc/termcap file \n");
  1428. ***************
  1429. *** 678,686 ****
  1430.           Booleans[value] = 0;
  1431.       for (value = 0; value < 128; value++)    
  1432.           Numbers[value] = 0;
  1433. !     Find_term();
  1434. !     CAP_PARSE();
  1435.   #endif
  1436.       if ((String_table[cm__] == NULL) || (Booleans[hc__]))
  1437.       {
  1438.           fprintf(stderr, "sorry, unable to use this terminal type for screen editing\n");
  1439. --- 783,802 ----
  1440.           Booleans[value] = 0;
  1441.       for (value = 0; value < 128; value++)    
  1442.           Numbers[value] = 0;
  1443. !     Data_Line = malloc(512);
  1444. !     if (pointer && *pointer != '/')
  1445. !     {
  1446. !         TERM_data_ptr = pointer;
  1447. !         CAP_PARSE();
  1448. !     }
  1449. !     else
  1450. !     {
  1451. !         Find_term();
  1452. !         CAP_PARSE();
  1453. !     }
  1454.   #endif
  1455. +     if (String_table[pc__] == NULL) 
  1456. +         String_table[pc__] = "\0";
  1457.       if ((String_table[cm__] == NULL) || (Booleans[hc__]))
  1458.       {
  1459.           fprintf(stderr, "sorry, unable to use this terminal type for screen editing\n");
  1460. ***************
  1461. *** 701,706 ****
  1462. --- 817,836 ----
  1463.           if (value > 0)
  1464.               COLS = value;
  1465.       }
  1466. + #ifdef TIOCGWINSZ
  1467. +     /*
  1468. +      |    get the window size
  1469. +      */
  1470. +     if (ioctl(0, TIOCGWINSZ, &ws) < 0)
  1471. +     {
  1472. +         perror("TIOCGWINSZ");
  1473. +         exit(1);
  1474. +     }
  1475. +     if (ws.ws_row > 0)
  1476. +         LINES = ws.ws_row;
  1477. +     if (ws.ws_col > 0)
  1478. +         COLS = ws.ws_col;
  1479. + #endif
  1480.       virtual_scr = newwin(LINES, COLS, 0, 0);
  1481.       stdscr = newwin(LINES, COLS, 0, 0);
  1482.       curscr = newwin(LINES, COLS, 0, 0);
  1483. ***************
  1484. *** 709,714 ****
  1485. --- 839,852 ----
  1486.       Repaint_screen = TRUE;
  1487.       initialized = TRUE;
  1488.       virtual_lines = (int *) malloc(LINES * (sizeof(int)));
  1489. + #ifdef SIGWINCH
  1490. +     /*
  1491. +      |    reset size of windows and LINES and COLS if term window 
  1492. +      |    changes size
  1493. +      */
  1494. +     signal(SIGWINCH, reinitscr);
  1495. + #endif /* SIGWINCH */
  1496.   }
  1497.   
  1498.   #ifndef CAP
  1499. ***************
  1500. *** 892,897 ****
  1501. --- 1030,1037 ----
  1502.               Counter++;
  1503.               Temp++;
  1504.           }
  1505. +         if (Counter == 1)    /* no data */
  1506. +             return(NULL);
  1507.           String = Temp = malloc(Counter);
  1508.           while ((*TERM_data_ptr != ':') && (*TERM_data_ptr != NULL))
  1509.           {
  1510. ***************
  1511. *** 948,955 ****
  1512.       {
  1513.           while ((*TERM_data_ptr != NULL) && (*TERM_data_ptr != ':'))
  1514.               TERM_data_ptr++;
  1515. -         if (*TERM_data_ptr == ':')
  1516. -             TERM_data_ptr++;
  1517.       }
  1518.       return(param);
  1519.   }
  1520. --- 1088,1093 ----
  1521. ***************
  1522. *** 966,973 ****
  1523.               TERM_data_ptr++;
  1524.           TERM_data_ptr++;
  1525.           Itemp = AtoI();
  1526. -         if (*TERM_data_ptr == ':')
  1527. -             TERM_data_ptr++;
  1528.           param = Itemp;
  1529.       }
  1530.       else
  1531. --- 1104,1109 ----
  1532. ***************
  1533. *** 974,981 ****
  1534.       {
  1535.           while (*TERM_data_ptr != ':')
  1536.               TERM_data_ptr++;
  1537. -         if (*TERM_data_ptr == ':')
  1538. -             TERM_data_ptr++;
  1539.       }
  1540.       return(param);
  1541.   }
  1542. --- 1110,1115 ----
  1543. ***************
  1544. *** 991,997 ****
  1545.           Ftemp++;
  1546.       *Ftemp++ = '|';
  1547.       *Ftemp = NULL;
  1548. -     Data_Line = malloc(512);
  1549.       CFOUND = FALSE;
  1550.       Data_Line_len = strlen(TERMINAL_TYPE) + 1;
  1551.       while ((!CFOUND) && ((TERM_data_ptr=fgets(Data_Line, 512, TFP)) != NULL))
  1552. --- 1125,1130 ----
  1553. ***************
  1554. *** 1183,1191 ****
  1555.                   if (*Otemp == 'd')
  1556.                        printf("%d", p1);
  1557.                   else if (*Otemp == '2')
  1558. !                     printf("%2d", p1);
  1559.                   else if (*Otemp == '3')
  1560. !                     printf("%3d", p1);
  1561.                   else if (*Otemp == '+')
  1562.                   {
  1563.                       Otemp++;
  1564. --- 1316,1324 ----
  1565.                   if (*Otemp == 'd')
  1566.                        printf("%d", p1);
  1567.                   else if (*Otemp == '2')
  1568. !                     printf("%02d", p1);
  1569.                   else if (*Otemp == '3')
  1570. !                     printf("%03d", p1);
  1571.                   else if (*Otemp == '+')
  1572.                   {
  1573.                       Otemp++;
  1574. ***************
  1575. *** 1785,1790 ****
  1576. --- 1918,1925 ----
  1577.       int user_col = 0;
  1578.       int virt_col = 0;
  1579.   
  1580. +     if (window->SR >= virtual_scr->Num_lines)
  1581. +         return;
  1582.       user_line = window->first_line;
  1583.       virtual_line = virtual_scr->first_line;
  1584.       virtual_scr->SCROLL_CLEAR = window->SCROLL_CLEAR;
  1585. ***************
  1586. *** 1798,1808 ****
  1587.       {
  1588.           virtual_line = virtual_line->next_screen;
  1589.       }
  1590. !     for (line_counter = 0; line_counter < window->Num_lines; line_counter++)
  1591.       {
  1592.           if ((last_window_refreshed != window) || (user_line->changed) || ((SCROLL | CLEAR) & window->SCROLL_CLEAR))
  1593.           {
  1594. !             for (user_col = 0, virt_col = window->SC; user_col < window->Num_cols; virt_col++, user_col++)
  1595.               {
  1596.                   virtual_line->row[virt_col] = user_line->row[user_col];
  1597.                   virtual_line->attributes[virt_col] = user_line->attributes[user_col];
  1598. --- 1933,1948 ----
  1599.       {
  1600.           virtual_line = virtual_line->next_screen;
  1601.       }
  1602. !     for (line_counter = 0; (line_counter < window->Num_lines)
  1603. !         && ((line_counter + window->SR) < virtual_scr->Num_lines); 
  1604. !             line_counter++)
  1605.       {
  1606.           if ((last_window_refreshed != window) || (user_line->changed) || ((SCROLL | CLEAR) & window->SCROLL_CLEAR))
  1607.           {
  1608. !             for (user_col = 0, virt_col = window->SC; 
  1609. !                 (virt_col < virtual_scr->Num_cols) 
  1610. !                   && (user_col < window->Num_cols); 
  1611. !                       virt_col++, user_col++)
  1612.               {
  1613.                   virtual_line->row[virt_col] = user_line->row[user_col];
  1614.                   virtual_line->attributes[virt_col] = user_line->attributes[user_col];
  1615. ***************
  1616. *** 1814,1824 ****
  1617.               {
  1618.                   if (virtual_line->row[virtual_line->last_char] == NULL)
  1619.                       virtual_line->row[virtual_line->last_char] = ' ';
  1620. !                 virtual_line->last_char = user_line->last_char + window->SC;
  1621.               }
  1622.               else if (virtual_line->last_char > (user_line->last_char + window->SC))
  1623.               {
  1624. !                 virtual_line->row[window->SC + user_line->last_char] = ' ';
  1625.               }
  1626.           }
  1627.           else
  1628. --- 1954,1967 ----
  1629.               {
  1630.                   if (virtual_line->row[virtual_line->last_char] == NULL)
  1631.                       virtual_line->row[virtual_line->last_char] = ' ';
  1632. !                 virtual_line->last_char = 
  1633. !                     min(virtual_scr->Num_cols, 
  1634. !                       (user_line->last_char + window->SC));
  1635.               }
  1636.               else if (virtual_line->last_char > (user_line->last_char + window->SC))
  1637.               {
  1638. !                 virtual_line->row[min(virtual_scr->Num_cols, 
  1639. !                       (user_line->last_char + window->SC))] = ' ';
  1640.               }
  1641.           }
  1642.           else
  1643. ***************
  1644. *** 1852,1858 ****
  1645. --- 1995,2032 ----
  1646.           in_buff[bufp++] = c;
  1647.   }
  1648.   
  1649. + #ifdef BSD_SELECT
  1650.   int 
  1651. + timed_getchar()
  1652. + {
  1653. +     struct timeval tv;
  1654. +     fd_set fds;
  1655. +     int ret_val;
  1656. +     int nfds = getdtablesize();
  1657. +     FD_ZERO(&fds);
  1658. +     tv.tv_sec = 0;
  1659. +     tv.tv_usec = 500000;  /* half a second */
  1660. +     FD_SET(0, &fds);
  1661. +     Time_Out = FALSE; /* just in case */
  1662. +     ret_val = select(nfds, &fds, 0, 0, &tv);
  1663. +     /*
  1664. +      |    if ret_val is less than zero, there was no input
  1665. +      |    otherwise, get a character and return it
  1666. +      */
  1667. +     if (ret_val <= 0)
  1668. +     { 
  1669. +         Time_Out = TRUE;
  1670. +         return(-1);
  1671. +     }
  1672. +     return(getchar());
  1673. + }
  1674. + #endif
  1675.   wgetch(window)            /* get character from specified window    */
  1676.   WINDOW *window;
  1677.   {
  1678. ***************
  1679. *** 1859,1900 ****
  1680.       int old_arg;
  1681.       int in_value;
  1682.   
  1683. ! #ifndef SYS5
  1684. !     if (!Nowait)
  1685.       {
  1686.           Time_Out = FALSE;
  1687. -         Nowait = TRUE;
  1688.           old_arg = fcntl(0, F_GETFL, 0);
  1689. !         value = fcntl(0, F_SETFL, old_arg | FNDELAY);
  1690.       }
  1691. - #endif
  1692.       in_value = ((bufp > 0) ? in_buff[--bufp] : getchar());
  1693.       if (in_value != -1) 
  1694.       {
  1695.           in_value &= 0xff;
  1696. !         if ((Parity) && (Num_bits < 8))    /* strip eighth bit if parity in use */
  1697.           in_value &= 0177;
  1698.       }
  1699. !     if ((in_value == '\033') || (in_value == '\037'))        /* escape character        */
  1700. !         in_value = Get_key(in_value);
  1701. ! #ifndef SYS5
  1702. !     if (!Time_Out)
  1703.       {
  1704. !         Nowait = FALSE;
  1705. !         value = fcntl(0, F_SETFL, old_arg);
  1706.       }
  1707. ! #endif
  1708.       return(in_value);
  1709.   }
  1710.   
  1711.   Clear()        /* notify that time out has occurred    */
  1712.   {
  1713.       Time_Out = TRUE;
  1714.   }
  1715.   
  1716.   int 
  1717. ! Get_key(first_char)            /* try to decode key sequence        */
  1718. ! int first_char;                /* first character of sequence        */
  1719.   {
  1720.       int in_char;
  1721.       int Count;
  1722. --- 2033,2091 ----
  1723.       int old_arg;
  1724.       int in_value;
  1725.   
  1726. ! #ifdef SYS5
  1727. !     in_value = ((bufp > 0) ? in_buff[--bufp] : getchar());
  1728. ! #else /* SYS5 */
  1729. ! #ifdef BSD_SELECT
  1730. !     if (Noblock)
  1731. !         in_value = ((bufp > 0) ? in_buff[--bufp] : timed_getchar());
  1732. !     else
  1733. !         in_value = ((bufp > 0) ? in_buff[--bufp] : getchar());
  1734. ! #else /* BSD_SELECT */
  1735. !     if (Noblock)
  1736.       {
  1737.           Time_Out = FALSE;
  1738.           old_arg = fcntl(0, F_GETFL, 0);
  1739. !         in_value = fcntl(0, F_SETFL, old_arg | FNDELAY);
  1740.       }
  1741.       in_value = ((bufp > 0) ? in_buff[--bufp] : getchar());
  1742. +     if (Noblock)
  1743. +     {
  1744. +         fcntl(0, F_SETFL, old_arg);
  1745. +         if (Time_Out)
  1746. +             in_value = -1;
  1747. +     }
  1748. + #endif /* BSD_SELECT */
  1749. + #endif /* SYS5 */
  1750.       if (in_value != -1) 
  1751.       {
  1752.           in_value &= 0xff;
  1753. !         if ((Parity) && (Num_bits < 8))    
  1754. !                 /* strip eighth bit if parity in use */
  1755.           in_value &= 0177;
  1756.       }
  1757. !     else if (interrupt_flag)
  1758.       {
  1759. !         interrupt_flag = FALSE;
  1760. !         in_value = wgetch(window);
  1761.       }
  1762. !     if ((in_value == '\033') || (in_value == '\037'))/* escape character */
  1763. !         in_value = Get_key(in_value);
  1764.       return(in_value);
  1765.   }
  1766.   
  1767. + #ifndef BSD_SELECT
  1768.   Clear()        /* notify that time out has occurred    */
  1769.   {
  1770.       Time_Out = TRUE;
  1771.   }
  1772. + #endif /* BSD_SELECT */
  1773.   
  1774.   int 
  1775. ! Get_key(first_char)            /* try to decode key sequence    */
  1776. ! int first_char;                /* first character of sequence    */
  1777.   {
  1778.       int in_char;
  1779.       int Count;
  1780. ***************
  1781. *** 1915,1922 ****
  1782. --- 2106,2115 ----
  1783.       string[Count++] = first_char;
  1784.       string[Count] = NULL;
  1785.       Time_Out = FALSE;
  1786. + #ifndef BSD_SELECT
  1787.       signal(SIGALRM, Clear);
  1788.       value = alarm(1);
  1789. + #endif /* BSD_SELECT */
  1790.   #ifdef SYS5
  1791.   /*    value = ioctl(0, TCGETA, &Gterminal);
  1792.       Gterminal.c_cc[VMIN] = 0;    /* minimum of zero characters    */
  1793. ***************
  1794. *** 1925,1930 ****
  1795. --- 2118,2124 ----
  1796.       Gterminal.c_lflag &= ~ECHO;        /* disable echo        */
  1797.   /*    value = ioctl(0, TCSETA, &Gterminal);    /* set characteristics    */
  1798.   #else
  1799. +     Noblock = TRUE;
  1800.   /*    value = ioctl(0, TIOCGETP, &Gterminal);
  1801.       Gterminal.sg_flags |= RAW ;
  1802.       Gterminal.sg_flags &= ~ECHO;
  1803. ***************
  1804. *** 1951,1961 ****
  1805. --- 2145,2158 ----
  1806.               }
  1807.           }
  1808.       }
  1809. + #ifndef BSD_SELECT
  1810.       if (!Time_Out)
  1811.           value = alarm(0);
  1812. + #endif /* BSD_SELECT */
  1813.   #ifdef SYS5
  1814.   /*    value = ioctl(0, TCSETA, &Terminal);*/
  1815.   #else
  1816. +     Noblock = FALSE;
  1817.       value = ioctl(0, TIOCSETP, &Terminal);
  1818.   /*    value = fcntl(0, F_SETFL, old_arg);*/
  1819.   #endif
  1820. ***************
  1821. *** 2626,2631 ****
  1822. --- 2823,2834 ----
  1823.       tmp1->last_char = column;
  1824.       if (column < COLS)
  1825.       {
  1826. +         if (STAND)
  1827. +         {
  1828. +             STAND = FALSE;
  1829. +             Position(window, row, column);
  1830. +             attribute_off();
  1831. +         }
  1832.           if (String_table[ce__] != NULL)
  1833.               String_Out(String_table[ce__], NULL, 0);
  1834.           else
  1835. ***************
  1836. *** 2632,2637 ****
  1837. --- 2835,2841 ----
  1838.           {
  1839.               for (x = column; x < window->Num_cols; x++)
  1840.                   putchar(' ');
  1841. +             Curr_x = x;
  1842.           }
  1843.       }
  1844.   }
  1845. ***************
  1846. *** 2669,2675 ****
  1847.               if (new_lin[end_new+k] == NULL)
  1848.               {
  1849.                   Position(window, line, (end_new+k));
  1850. !                         CLEAR_TO_EOL(window, line, (end_new+k));
  1851.               }
  1852.               Position(window, line, offset);
  1853.               for (k = offset; k < end_old; k++)
  1854. --- 2873,2879 ----
  1855.               if (new_lin[end_new+k] == NULL)
  1856.               {
  1857.                   Position(window, line, (end_new+k));
  1858. !                 CLEAR_TO_EOL(window, line, (end_new+k));
  1859.               }
  1860.               Position(window, line, offset);
  1861.               for (k = offset; k < end_old; k++)
  1862. ***************
  1863. *** 3162,3168 ****
  1864.           attributes_set[0] = 0;
  1865.           String_Out(String_table[sa__], attributes_set, 1);
  1866.       }
  1867. !     else if (String_table[sa__])
  1868.           String_Out(String_table[se__], NULL, 0);
  1869.   }
  1870.   
  1871. --- 3366,3372 ----
  1872.           attributes_set[0] = 0;
  1873.           String_Out(String_table[sa__], attributes_set, 1);
  1874.       }
  1875. !     else if (String_table[se__])
  1876.           String_Out(String_table[se__], NULL, 0);
  1877.   }
  1878.   
  1879. exit 0 # Just in case...
  1880.