aboutsummaryrefslogtreecommitdiff
path: root/shell/cmdedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/cmdedit.c')
-rw-r--r--shell/cmdedit.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 3b4750455..2ec81548d 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -1167,25 +1167,21 @@ int cmdedit_read_input(char *prompt, char command[BUFSIZ])
1167 len = 0; 1167 len = 0;
1168 command_ps = command; 1168 command_ps = command;
1169 1169
1170 if (new_settings.c_cc[VERASE] == 0) { /* first call */ 1170 getTermSettings(0, (void *) &initial_settings);
1171 1171 memcpy(&new_settings, &initial_settings, sizeof(struct termios));
1172 getTermSettings(0, (void *) &initial_settings); 1172 new_settings.c_lflag &= ~ICANON; /* unbuffered input */
1173 memcpy(&new_settings, &initial_settings, sizeof(struct termios)); 1173 /* Turn off echoing and CTRL-C, so we can trap it */
1174 new_settings.c_lflag &= ~ICANON; /* unbuffered input */ 1174 new_settings.c_lflag &= ~(ECHO | ECHONL | ISIG);
1175 /* Turn off echoing and CTRL-C, so we can trap it */
1176 new_settings.c_lflag &= ~(ECHO | ECHONL | ISIG);
1177#ifndef linux 1175#ifndef linux
1178 /* Hmm, in linux c_cc[] not parsed if set ~ICANON */ 1176 /* Hmm, in linux c_cc[] not parsed if set ~ICANON */
1179 new_settings.c_cc[VMIN] = 1; 1177 new_settings.c_cc[VMIN] = 1;
1180 new_settings.c_cc[VTIME] = 0; 1178 new_settings.c_cc[VTIME] = 0;
1181 /* Turn off CTRL-C, so we can trap it */ 1179 /* Turn off CTRL-C, so we can trap it */
1182# ifndef _POSIX_VDISABLE 1180# ifndef _POSIX_VDISABLE
1183# define _POSIX_VDISABLE '\0' 1181# define _POSIX_VDISABLE '\0'
1184# endif 1182# endif
1185 new_settings.c_cc[VINTR] = _POSIX_VDISABLE; 1183 new_settings.c_cc[VINTR] = _POSIX_VDISABLE;
1186#endif 1184#endif
1187 }
1188
1189 command[0] = 0; 1185 command[0] = 0;
1190 1186
1191 setTermSettings(0, (void *) &new_settings); 1187 setTermSettings(0, (void *) &new_settings);