utashiro@sran84.sra.JUNET (Kazumasa Utashiro) (01/06/89)
Description: * CTRL -> ctrl for ansi style compiler * fixed longjmp parameter mismatch * check the tty control character has positive value * default bindings averride tty control characters thanks to cudcv@warwick.ac.uk (Rob McMahon) * Change to terminate when received HUP signal thanks to <quiroz@cs.rochester.edu> *** /tmp/,RCSt1015680 Fri Jan 6 12:13:56 1989 --- fep_vi.c Fri Jan 6 10:48:22 1989 *************** *** 2,8 #ifndef lint static char rcsid[]= ! "$Header: fep_vi.c,v 4.3 88/08/28 14:36:55 utashiro Exp $ (SRA)"; #endif lint #include <stdio.h> --- 2,8 ----- #ifndef lint static char rcsid[]= ! "$Header: fep_vi.c,v 4.5 89/01/06 10:48:17 utashiro Exp $ (SRA)"; #endif lint #include <stdio.h> *************** *** 159,170 for (i = 0; i < 256; i++) cft[i] = self_insert; ! for (ftp = viComBindings; ftp->bt_s; ftp++) { ! bind_key (aft, ftp->bt_func, ftp->bt_s, abort); ! } ! for (ftp = viInsertBindings; ftp->bt_s; ftp++) { ! bind_key (cft, ftp->bt_func, ftp->bt_s, abort); ! } /* Now, using cbreak mode cft[(int) tchars_buf.t_startx] = ignore; --- 159,165 ----- for (i = 0; i < 256; i++) cft[i] = self_insert; ! #define import(table,key,fn) if((int)key>0)table[(int)key]=fn /* Now, using cbreak mode import (cft, tchars_buf.t_startx, ignore); *************** *** 167,174 } /* Now, using cbreak mode ! cft[(int) tchars_buf.t_startx] = ignore; ! cft[(int) tchars_buf.t_stopc] = ignore; */ cft[(int) tchars_buf.t_intrc] = insert_and_flush; aft[(int) tchars_buf.t_intrc] = insert_and_flush; --- 162,169 ----- #define import(table,key,fn) if((int)key>0)table[(int)key]=fn /* Now, using cbreak mode ! import (cft, tchars_buf.t_startx, ignore); ! import (cft, tchars_buf.t_stopc, ignore); */ import (cft, tchars_buf.t_intrc, insert_and_flush); import (aft, tchars_buf.t_intrc, insert_and_flush); *************** *** 170,188 cft[(int) tchars_buf.t_startx] = ignore; cft[(int) tchars_buf.t_stopc] = ignore; */ ! cft[(int) tchars_buf.t_intrc] = insert_and_flush; ! aft[(int) tchars_buf.t_intrc] = insert_and_flush; ! cft[(int) tchars_buf.t_quitc] = insert_and_flush; ! cft[(int) tchars_buf.t_eofc] = send_eof; ! cft[(int) tchars_buf.t_brkc] = insert_and_flush; ! cft[(int) ltchars_buf.t_suspc] = insert_and_flush; ! cft[(int) ltchars_buf.t_dsuspc] = self_insert; ! cft[(int) ltchars_buf.t_rprntc] = reprint; ! cft[(int) ltchars_buf.t_flushc] = self_insert; ! cft[(int) ltchars_buf.t_werasc] = delete_previous_word; ! cft[(int) ltchars_buf.t_lnextc] = literal_next; ! cft[(int) initial_ttymode.sg_erase] = delete_previous_character; ! cft[(int) initial_ttymode.sg_kill] = delete_line; viInsTable = cft; viComTable = aft; --- 165,183 ----- import (cft, tchars_buf.t_startx, ignore); import (cft, tchars_buf.t_stopc, ignore); */ ! import (cft, tchars_buf.t_intrc, insert_and_flush); ! import (aft, tchars_buf.t_intrc, insert_and_flush); ! import (cft, tchars_buf.t_quitc, insert_and_flush); ! import (cft, tchars_buf.t_eofc, send_eof); ! import (cft, tchars_buf.t_brkc, insert_and_flush); ! import (cft, ltchars_buf.t_suspc, insert_and_flush); ! import (cft, ltchars_buf.t_dsuspc, self_insert); ! import (cft, ltchars_buf.t_rprntc, reprint); ! import (cft, ltchars_buf.t_flushc, self_insert); ! import (cft, ltchars_buf.t_werasc, delete_previous_word); ! import (cft, ltchars_buf.t_lnextc, literal_next); ! import (cft, initial_ttymode.sg_erase, delete_previous_character); ! import (cft, initial_ttymode.sg_kill, delete_line); #undef import *************** *** 184,189 cft[(int) initial_ttymode.sg_erase] = delete_previous_character; cft[(int) initial_ttymode.sg_kill] = delete_line; viInsTable = cft; viComTable = aft; vi_mode = INSERTMODE; --- 179,191 ----- import (cft, initial_ttymode.sg_erase, delete_previous_character); import (cft, initial_ttymode.sg_kill, delete_line); + #undef import + + for (ftp = viComBindings; ftp->bt_s; ftp++) + bind_key (aft, ftp->bt_func, ftp->bt_s, abort); + for (ftp = viInsertBindings; ftp->bt_s; ftp++) + bind_key (cft, ftp->bt_func, ftp->bt_s, abort); + viInsTable = cft; viComTable = aft; vi_mode = INSERTMODE; *************** *** 265,271 (void) backward_character (); break; ! case CTRL(U): (void) delete_line (c); (void) altenateEditmode (); break; --- 267,273 ----- (void) backward_character (); break; ! case ctrl('U'): (void) delete_line (c); (void) altenateEditmode (); break; *************** *** 489,495 { switch (c) { ! case CTRL(H): (void) delete_previous_character (c); break; --- 491,497 ----- { switch (c) { ! case ctrl('H'): (void) delete_previous_character (c); break; *************** *** 493,499 (void) delete_previous_character (c); break; ! case CTRL(W): (void) delete_previous_word (c); break; --- 495,501 ----- (void) delete_previous_character (c); break; ! case ctrl('W'): (void) delete_previous_word (c); break; *************** *** 497,503 (void) delete_previous_word (c); break; ! case CTRL(U): (void) delete_line (c); break; --- 499,505 ----- (void) delete_previous_word (c); break; ! case ctrl('U'): (void) delete_line (c); break; *************** *** 501,507 (void) delete_line (c); break; ! case CTRL(V): (void) literal_next (c); break; --- 503,509 ----- (void) delete_line (c); break; ! case ctrl('V'): (void) literal_next (c); break; *** /tmp/,RCSt1015702 Fri Jan 6 12:14:08 1989 --- fep_com.c Fri Jan 6 10:07:28 1989 *************** *** 2,8 #ifndef lint static char rcsid[]= ! "$Header: fep_com.c,v 4.7 88/11/13 15:51:24 utashiro Exp $ (SRA)"; #endif lint #include <stdio.h> --- 2,8 ----- #ifndef lint static char rcsid[]= ! "$Header: fep_com.c,v 4.8 89/01/06 10:07:12 utashiro Exp $ (SRA)"; #endif lint #include <stdio.h> *************** *** 660,666 --mp->cur_line; break; ! case 'd': case CTRL(D): mp->cur_line /= 2; break; --- 660,666 ----- --mp->cur_line; break; ! case 'd': case ctrl('D'): mp->cur_line /= 2; break; *************** *** 664,670 mp->cur_line /= 2; break; ! case 'q': case 'Q': case CTRL(C): DELMORE; return (0); --- 664,670 ----- mp->cur_line /= 2; break; ! case 'q': case 'Q': case ctrl('C'): DELMORE; return (0); *** /tmp/,RCSt1015712 Fri Jan 6 12:14:17 1989 --- fep_edit.c Fri Jan 6 10:48:16 1989 *************** *** 2,8 #ifndef lint static char rcsid[]= ! "$Header: fep_edit.c,v 4.6 88/11/25 20:51:53 utashiro Exp $ (SRA)"; #endif lint #include <stdio.h> --- 2,8 ----- #ifndef lint static char rcsid[]= ! "$Header: fep_edit.c,v 4.8 89/01/06 10:45:20 utashiro Exp $ (SRA)"; #endif lint #include <stdio.h> *************** *** 189,197 for (i = 0; i < 256; i++) cft[i] = self_insert; - for (ftp = emacsBindings; ftp->bt_s; ftp++) { - bind_key (cft, ftp->bt_func, ftp->bt_s, abort); - } /* Now, using cbreak mode cft[(int) tchars_buf.t_startc] = ignore; --- 189,194 ----- for (i = 0; i < 256; i++) cft[i] = self_insert; #define import(table,key,fn) if((int)key>0)table[(int)key]=fn *************** *** 193,198 bind_key (cft, ftp->bt_func, ftp->bt_s, abort); } /* Now, using cbreak mode cft[(int) tchars_buf.t_startc] = ignore; cft[(int) tchars_buf.t_stopc] = ignore; --- 190,197 ----- for (i = 0; i < 256; i++) cft[i] = self_insert; + #define import(table,key,fn) if((int)key>0)table[(int)key]=fn + /* Now, using cbreak mode import (cft, tchars_buf.t_startc, ignore); import (cft, tchars_buf.t_stopc, ignore); *************** *** 194,201 } /* Now, using cbreak mode ! cft[(int) tchars_buf.t_startc] = ignore; ! cft[(int) tchars_buf.t_stopc] = ignore; */ cft[(int) tchars_buf.t_intrc] = insert_and_flush; cft[(int) tchars_buf.t_quitc] = insert_and_flush; --- 193,200 ----- #define import(table,key,fn) if((int)key>0)table[(int)key]=fn /* Now, using cbreak mode ! import (cft, tchars_buf.t_startc, ignore); ! import (cft, tchars_buf.t_stopc, ignore); */ import (cft, tchars_buf.t_intrc, insert_and_flush); import (cft, tchars_buf.t_quitc, insert_and_flush); *************** *** 197,204 cft[(int) tchars_buf.t_startc] = ignore; cft[(int) tchars_buf.t_stopc] = ignore; */ ! cft[(int) tchars_buf.t_intrc] = insert_and_flush; ! cft[(int) tchars_buf.t_quitc] = insert_and_flush; /* Now, EOF will be sent on empty line. cft[(int) tchars_buf.t_eofc] = send_eof; */ --- 196,203 ----- import (cft, tchars_buf.t_startc, ignore); import (cft, tchars_buf.t_stopc, ignore); */ ! import (cft, tchars_buf.t_intrc, insert_and_flush); ! import (cft, tchars_buf.t_quitc, insert_and_flush); /* Now, EOF will be sent on empty line. import (cft, tchars_buf.t_eofc, send_eof); */ *************** *** 200,206 cft[(int) tchars_buf.t_intrc] = insert_and_flush; cft[(int) tchars_buf.t_quitc] = insert_and_flush; /* Now, EOF will be sent on empty line. ! cft[(int) tchars_buf.t_eofc] = send_eof; */ cft[(int) tchars_buf.t_brkc] = insert_and_flush; cft[(int) ltchars_buf.t_suspc] = insert_and_flush; --- 199,205 ----- import (cft, tchars_buf.t_intrc, insert_and_flush); import (cft, tchars_buf.t_quitc, insert_and_flush); /* Now, EOF will be sent on empty line. ! import (cft, tchars_buf.t_eofc, send_eof); */ import (cft, tchars_buf.t_brkc, insert_and_flush); import (cft, ltchars_buf.t_suspc, insert_and_flush); *************** *** 202,209 /* Now, EOF will be sent on empty line. cft[(int) tchars_buf.t_eofc] = send_eof; */ ! cft[(int) tchars_buf.t_brkc] = insert_and_flush; ! cft[(int) ltchars_buf.t_suspc] = insert_and_flush; /* ^Y is used for yank-from-kill-buffer cft[(int) ltchars_buf.t_dsuspc] = self_insert; */ --- 201,208 ----- /* Now, EOF will be sent on empty line. import (cft, tchars_buf.t_eofc, send_eof); */ ! import (cft, tchars_buf.t_brkc, insert_and_flush); ! import (cft, ltchars_buf.t_suspc, insert_and_flush); /* ^Y is used for yank-from-kill-buffer import (cft, ltchars_buf.t_dsuspc, self_insert); */ *************** *** 205,211 cft[(int) tchars_buf.t_brkc] = insert_and_flush; cft[(int) ltchars_buf.t_suspc] = insert_and_flush; /* ^Y is used for yank-from-kill-buffer ! cft[(int) ltchars_buf.t_dsuspc] = self_insert; */ cft[(int) ltchars_buf.t_rprntc] = reprint; cft[(int) ltchars_buf.t_flushc] = self_insert; --- 204,210 ----- import (cft, tchars_buf.t_brkc, insert_and_flush); import (cft, ltchars_buf.t_suspc, insert_and_flush); /* ^Y is used for yank-from-kill-buffer ! import (cft, ltchars_buf.t_dsuspc, self_insert); */ import (cft, ltchars_buf.t_rprntc, reprint); import (cft, ltchars_buf.t_flushc, self_insert); *************** *** 207,218 /* ^Y is used for yank-from-kill-buffer cft[(int) ltchars_buf.t_dsuspc] = self_insert; */ ! cft[(int) ltchars_buf.t_rprntc] = reprint; ! cft[(int) ltchars_buf.t_flushc] = self_insert; ! cft[(int) ltchars_buf.t_werasc] = delete_previous_word; ! cft[(int) ltchars_buf.t_lnextc] = literal_next; ! cft[(int) initial_ttymode.sg_erase] = delete_previous_character; ! cft[(int) initial_ttymode.sg_kill] = delete_line; } /* --- 206,226 ----- /* ^Y is used for yank-from-kill-buffer import (cft, ltchars_buf.t_dsuspc, self_insert); */ ! import (cft, ltchars_buf.t_rprntc, reprint); ! import (cft, ltchars_buf.t_flushc, self_insert); ! import (cft, ltchars_buf.t_werasc, delete_previous_word); ! import (cft, ltchars_buf.t_lnextc, literal_next); ! import (cft, initial_ttymode.sg_erase, delete_previous_character); ! import (cft, initial_ttymode.sg_kill, delete_line); ! ! #undef import ! ! /* ! * Set default bindings ! */ ! for (ftp = emacsBindings; ftp->bt_s; ftp++) { ! bind_key (cft, ftp->bt_func, ftp->bt_s, abort); ! } } /* *************** *** 236,242 NeedSave = 0; editstatus = EDITING; processed = 0; ! setjmp (jbuf); /* * If there is file pointer for I/O redirection, --- 244,250 ----- NeedSave = 0; editstatus = EDITING; processed = 0; ! (void) setjmp (jbuf); /* * If there is file pointer for I/O redirection, *************** *** 1737,1743 fputs ("\r\n", stdout); perror ("alloca:"); reprint (); ! longjmp (jbuf); } strcpy (fcp, dp->d_name); fileList [i++] = fcp; --- 1745,1751 ----- fputs ("\r\n", stdout); perror ("alloca:"); reprint (); ! longjmp (jbuf, 1); } strcpy (fcp, dp->d_name); fileList [i++] = fcp; *************** *** 1928,1934 fputs ("\r\n", stdout); perror ("alloca:"); reprint (); ! longjmp (jbuf); } strcpy (fcp, dp->d_name); fileList [i++] = fcp; --- 1936,1942 ----- fputs ("\r\n", stdout); perror ("alloca:"); reprint (); ! longjmp (jbuf, 1); } strcpy (fcp, dp->d_name); fileList [i++] = fcp; *** /tmp/,RCSt1015722 Fri Jan 6 12:14:33 1989 --- fep_defs.h Fri Jan 6 10:07:32 1989 *************** *** 2,8 #ifndef lint # define FEP_DEFS \ ! "$Header: fep_defs.h,v 4.2 88/08/16 18:22:13 utashiro Exp $ (SRA)" #endif lint #define MAXCOMLEN 512 /* maximum command length */ --- 2,8 ----- #ifndef lint # define FEP_DEFS \ ! "$Header: fep_defs.h,v 4.3 89/01/06 10:07:29 utashiro Exp $ (SRA)" #endif lint #define MAXCOMLEN 512 /* maximum command length */ *************** *** 38,43 #endif KANJI #define unctl(c) (((c)=='\177') ? '?' : ((c) >= 040) ? (c) : (c)|0100) #define toctrl(c) ((c)&~0100) #define INDIRECTED (1<<(sizeof(char*)*8-1)) /* this is actually 0x80000000 on 32 bit machine, --- 38,44 ----- #endif KANJI #define unctl(c) (((c)=='\177') ? '?' : ((c) >= 040) ? (c) : (c)|0100) #define toctrl(c) ((c)&~0100) + #define ctrl(c) ((c)&037) #define INDIRECTED (1<<(sizeof(char*)*8-1)) /* this is actually 0x80000000 on 32 bit machine, *** /tmp/,RCSt1015744 Fri Jan 6 12:14:41 1989 --- fep_main.c Fri Jan 6 12:11:02 1989 *************** *** 2,8 #ifndef lint static char rcsid[]= ! "$Header: fep_main.c,v 4.4 88/12/08 15:43:45 utashiro Exp $ (SRA)"; #endif lint #include <stdio.h> --- 2,8 ----- #ifndef lint static char rcsid[]= ! "$Header: fep_main.c,v 4.5 89/01/06 12:10:30 utashiro Exp $ (SRA)"; #endif lint #include <stdio.h> *************** *** 275,281 fix_signal () { ! sighup = signal (SIGHUP, catchsig); sigchld = signal (SIGCHLD, catchsig); sigtstp = signal (SIGTSTP, SIG_IGN); } --- 275,281 ----- fix_signal () { ! sighup = signal (SIGHUP, terminate); sigchld = signal (SIGCHLD, catchsig); sigtstp = signal (SIGTSTP, SIG_IGN); }