summaryrefslogtreecommitdiff
path: root/misc/fep/patches/patch-ae
blob: 3075c3a5a0efb40991fabb27956d643237c50ce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
$NetBSD: patch-ae,v 1.1 2000/02/07 03:18:11 christos Exp $

--- fep_edit.c.orig	Fri Jan 20 03:16:37 1995
+++ fep_edit.c	Sun Feb  6 21:46:22 2000
@@ -8,7 +8,17 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/ioctl.h>
+#ifdef TERMIOS
+#include <termios.h>
+#ifdef __linux__
+#ifndef _POSIX_VDISABLE
+#define _POSIX_VDISABLE '\0'
+#endif
+#endif
+#else
 #include <sgtty.h>
+#endif
 #include <sys/time.h>
 #include <ctype.h>
 #include <sys/dir.h>
@@ -25,7 +35,7 @@
 EDITMODE	editmode = NOTYET;	/* edtimode EMACS, VI */
 EDITSTATUS	editstatus = NOTEDITING;/* EDITING, NOTEDITING */
 
-int	maxline = MAXCOMLEN;		/* maximum length of command line */
+int	maxline = MAXCMDLEN;		/* maximum length of command line */
 int	NeedNewLine;			/* add new line flag */
 int	NeedSave;			/* need to save to history */
 int	Transparency = OFF;		/* transparent flag */
@@ -86,7 +96,7 @@
 	/* ^X-^V	*/	{"\\^X\\^V",	view_buffer},
 	/* ^X-^K	*/	{"\\^X\\^K",	kill_to_top_of_line},
 	/* ^X-^L	*/	{"\\^X\\^L",	fep_repaint},
-	/* ^X-^C	*/	{"\\^X\\^C",	terminate},
+	/* ^X-^C	*/	{"\\^X\\^C",	(FUNC)terminate},
 	/* ^X-^D	*/	{"\\^X\\^D",	send_eof},
 	/* ^X-(		*/	{"\\^X(",	fep_start_script},
 	/* ^X-)		*/	{"\\^X)",	fep_end_script},
@@ -192,6 +202,30 @@
 
 #define import(table,key,fn) if((int)key>0)table[(int)key]=fn
 
+#ifdef TERMIOS
+    /* Now, using cbreak mode
+    import (cft, initial_ttymode.c_cc[VSTART], ignore);
+    import (cft, initial_ttymode.c_cc[VSTOP], ignore);
+    */
+    import (cft, initial_ttymode.c_cc[VINTR], insert_and_flush);
+    import (cft, initial_ttymode.c_cc[VQUIT], insert_and_flush);
+    /* Now, EOF will be sent on empty line.
+    import (cft, initial_ttymode.c_cc[VEOF], send_eof);
+    */
+#ifdef VSWTC
+    import (cft, initial_ttymode.c_cc[VSWTC], insert_and_flush);
+#endif
+    import (cft, initial_ttymode.c_cc[VSUSP], insert_and_flush);
+    /* ^Y is used for yank-from-kill-buffer
+    import (cft, initial_ttymode.c_cc[VDSUSP], self_insert);
+    */
+    import (cft, initial_ttymode.c_cc[VREPRINT], reprint);
+    import (cft, initial_ttymode.c_cc[VDISCARD], self_insert);
+    import (cft, initial_ttymode.c_cc[VWERASE], delete_previous_word);
+    import (cft, initial_ttymode.c_cc[VLNEXT], literal_next);
+    import (cft, initial_ttymode.c_cc[VERASE], delete_previous_character);
+    import (cft, initial_ttymode.c_cc[VKILL], delete_line);
+#else
     /* Now, using cbreak mode
     import (cft, tchars_buf.t_startc, ignore);
     import (cft, tchars_buf.t_stopc, ignore);
@@ -212,6 +246,7 @@
     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);
+#endif
 
 #undef import
 
@@ -257,7 +292,7 @@
 	 */
 	swallow_output();
 
-	if (fgets (CommandLine, MAXCOMLEN, redirect_fp)) {
+	if (fgets (CommandLine, MAXCMDLEN, redirect_fp)) {
 	    ++redirect_line;
 	    execute_command = CommandLine;
 	    goto RETURN;	    
@@ -301,7 +336,11 @@
 	 * call send_eof
 	 */
 	if (
+#ifdef TERMIOS
+	    c == initial_ttymode.c_cc[VEOF]
+#else
 	    c == tchars_buf.t_eofc
+#endif
 	    && curFuncTab[c] != send_eof
 	    && ! look_var ("ignore-eof")
 	    && CommandLine [0] == '\0'
@@ -1481,7 +1520,11 @@
  */
 send_eof()
 {
+#ifdef TERMIOS
+    char c = initial_ttymode.c_cc[VEOF];
+#else
     char c = tchars_buf.t_eofc;
+#endif
 
     (void) self_insert (c);
     if (isctlchar (c))
@@ -1754,7 +1797,7 @@
     fileList [i] = (char *) 0;
 
     if (*start_expand == '~' && look_var ("expand-tilde")) {
-	char *buf [256], *p;
+	char buf [256], *p;
 
 	strcpy (buf, start_expand);
 	p = x_dirname (buf);
@@ -2032,7 +2075,7 @@
 {
     char tmps[16];
 
-    if (s[0] == '\\' && s[1] == '^' && s[2] != NULL) {
+    if (s[0] == '\\' && s[1] == '^' && s[2] != '\0') {
 	tmps[0] = toctrl (s[2]);
 	strcpy (&tmps[1], &s[3]);
 	s = tmps;
@@ -2042,7 +2085,7 @@
      * If the string contain only one character, put the function to
      * appropriate position in the table.
      */
-    if (*(s+1) == NULL) {
+    if (*(s+1) == '\0') {
 	if (isIndirect (ft[(int) *s]))
 	    free (maskIndirect (ft[(int) *s]));