View | Details | Raw Unified | Return to bug 146916
Collapse All | Expand All

(-)histedit.c (+14 lines)
Lines 98-103 Link Here
98
			/*
98
			/*
99
			 * turn editing on
99
			 * turn editing on
100
			 */
100
			 */
101
			char *term;
102
101
			INTOFF;
103
			INTOFF;
102
			if (el_in == NULL)
104
			if (el_in == NULL)
103
				el_in = fdopen(0, "r");
105
				el_in = fdopen(0, "r");
Lines 107-112 Link Here
107
				el_out = fdopen(2, "w");
109
				el_out = fdopen(2, "w");
108
			if (el_in == NULL || el_err == NULL || el_out == NULL)
110
			if (el_in == NULL || el_err == NULL || el_out == NULL)
109
				goto bad;
111
				goto bad;
112
			term = lookupvar("TERM");
113
			if (term)
114
				setenv("TERM", term, 1);
115
			else
116
				unsetenv("TERM");
110
			el = el_init(arg0, el_in, el_out, el_err);
117
			el = el_init(arg0, el_in, el_out, el_err);
111
			if (el != NULL) {
118
			if (el != NULL) {
112
				if (hist)
119
				if (hist)
Lines 160-165 Link Here
160
	}
167
	}
161
}
168
}
162
169
170
void
171
setterm(const char *term)
172
{
173
	if (el != NULL && term != NULL)
174
		el_set(el, EL_TERMINAL, term);
175
}
176
163
int
177
int
164
histcmd(int argc, char **argv)
178
histcmd(int argc, char **argv)
165
{
179
{
(-)myhistedit.h (+1 lines)
Lines 38-43 Link Here
38
38
39
void histedit(void);
39
void histedit(void);
40
void sethistsize(const char *);
40
void sethistsize(const char *);
41
void setterm(const char *);
41
int histcmd(int, char **);
42
int histcmd(int, char **);
42
int not_fcnumber(const char *);
43
int not_fcnumber(const char *);
43
int str_to_event(const char *, int);
44
int str_to_event(const char *, int);
(-)var.c (+5 lines)
Lines 80-85 Link Here
80
80
81
#ifndef NO_HISTORY
81
#ifndef NO_HISTORY
82
struct var vhistsize;
82
struct var vhistsize;
83
struct var vterm;
83
#endif
84
#endif
84
struct var vifs;
85
struct var vifs;
85
struct var vmail;
86
struct var vmail;
Lines 114-119 Link Here
114
	  NULL },
115
	  NULL },
115
	{ &vps4,	0,				"PS4=+ ",
116
	{ &vps4,	0,				"PS4=+ ",
116
	  NULL },
117
	  NULL },
118
#ifndef NO_HISTORY
119
	{ &vterm,	VUNSET,				"TERM=",
120
	  setterm },
121
#endif
117
	{ &voptind,	0,				"OPTIND=1",
122
	{ &voptind,	0,				"OPTIND=1",
118
	  getoptsreset },
123
	  getoptsreset },
119
	{ NULL,	0,				NULL,
124
	{ NULL,	0,				NULL,
(-)var.h (+2 lines)
Lines 77-82 Link Here
77
extern struct var vps4;
77
extern struct var vps4;
78
#ifndef NO_HISTORY
78
#ifndef NO_HISTORY
79
extern struct var vhistsize;
79
extern struct var vhistsize;
80
extern struct var vterm;
80
#endif
81
#endif
81
82
82
/*
83
/*
Lines 96-101 Link Here
96
#define optindval()	(voptind.text + 7)
97
#define optindval()	(voptind.text + 7)
97
#ifndef NO_HISTORY
98
#ifndef NO_HISTORY
98
#define histsizeval()	(vhistsize.text + 9)
99
#define histsizeval()	(vhistsize.text + 9)
100
#define termval()	(vterm.text + 5)
99
#endif
101
#endif
100
102
101
#define mpathset()	((vmpath.flags & VUNSET) == 0)
103
#define mpathset()	((vmpath.flags & VUNSET) == 0)

Return to bug 146916