diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-26 11:28:43 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-26 11:28:43 +0100 |
commit | 3ff9be31be0c69802b2b29f397915b9dc1689c2e (patch) | |
tree | 643ead81ca4e49e46da821c2f51b1dd1161fbf3a | |
parent | d7c25e98bfd5dd62c19d6d672410ce61efa16801 (diff) | |
download | busybox-w32-3ff9be31be0c69802b2b29f397915b9dc1689c2e.tar.gz busybox-w32-3ff9be31be0c69802b2b29f397915b9dc1689c2e.tar.bz2 busybox-w32-3ff9be31be0c69802b2b29f397915b9dc1689c2e.zip |
getty: document bits we don't set - maybe we should set some of them?
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | loginutils/getty.c | 66 |
1 files changed, 59 insertions, 7 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c index 4e194c45f..2d2184a76 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -264,10 +264,17 @@ static void termios_init(int speed) | |||
264 | if (option_mask32 & F_RTSCTS) | 264 | if (option_mask32 & F_RTSCTS) |
265 | G.termios.c_cflag |= CRTSCTS; /* flow control using RTS/CTS pins */ | 265 | G.termios.c_cflag |= CRTSCTS; /* flow control using RTS/CTS pins */ |
266 | #endif | 266 | #endif |
267 | /* Other bits in c_cflag: | ||
268 | * CSTOPB 2 stop bits (1 otherwise) | ||
269 | * PARENB Enable parity bit | ||
270 | * PARODD Use odd parity (else even) | ||
271 | * LOBLK Block job control output (??) | ||
272 | */ | ||
267 | G.termios.c_iflag = 0; | 273 | G.termios.c_iflag = 0; |
268 | G.termios.c_lflag = 0; | 274 | G.termios.c_lflag = 0; |
269 | /* non-raw output; add CR to each NL */ | 275 | /* non-raw output; add CR to each NL */ |
270 | G.termios.c_oflag = OPOST | ONLCR; | 276 | G.termios.c_oflag = OPOST | ONLCR; |
277 | |||
271 | G.termios.c_cc[VMIN] = 1; /* block reads if < 1 char is available */ | 278 | G.termios.c_cc[VMIN] = 1; /* block reads if < 1 char is available */ |
272 | G.termios.c_cc[VTIME] = 0; /* no timeout (reads block forever) */ | 279 | G.termios.c_cc[VTIME] = 0; /* no timeout (reads block forever) */ |
273 | #ifdef __linux__ | 280 | #ifdef __linux__ |
@@ -281,18 +288,55 @@ static void termios_init(int speed) | |||
281 | 288 | ||
282 | static void termios_final(void) | 289 | static void termios_final(void) |
283 | { | 290 | { |
284 | /* software flow control on output; and on input */ | 291 | /* software flow control on output (stop sending if XOFF is recvd); |
292 | * and on input (send XOFF when buffer is full) | ||
293 | */ | ||
285 | G.termios.c_iflag |= IXON | IXOFF; | 294 | G.termios.c_iflag |= IXON | IXOFF; |
286 | if (G.eol == '\r') { | 295 | if (G.eol == '\r') { |
287 | G.termios.c_iflag |= ICRNL; /* map CR on input to NL */ | 296 | G.termios.c_iflag |= ICRNL; /* map CR on input to NL */ |
288 | } | 297 | } |
289 | /* non-raw input; enable SIGINT/QUIT/etc sigs; echo; | 298 | /* Other bits in c_iflag: |
290 | * echo erase character as BS-space-BS; | 299 | * IXANY Any recvd char enables output (any char is also a XON) |
291 | * echo NL on kill char; | 300 | * INPCK Enable parity check |
292 | * erase entire line via BS-space-BS on kill char */ | 301 | * IGNPAR Ignore parity errors (drop bad bytes) |
302 | * PARMRK Mark parity errors with 0xff, 0x00 prefix | ||
303 | * (else bad byte is received as 0x00) | ||
304 | * ISTRIP Strip parity bit | ||
305 | * IGNBRK Ignore break condition | ||
306 | * BRKINT Send SIGINT on break - maybe set this? | ||
307 | * INLCR Map NL to CR | ||
308 | * IGNCR Ignore CR | ||
309 | * ICRNL Map CR to NL | ||
310 | * IUCLC Map uppercase to lowercase | ||
311 | * IMAXBEL Echo BEL on input line too long | ||
312 | * IUTF8 [Appears to affect tty's idea of char widths, | ||
313 | * observed to improve backspacing through Unicode chars] | ||
314 | */ | ||
315 | |||
316 | /* line buffered input (NL or EOL or EOF chars end a line); | ||
317 | * recognize INT/QUIT/SUSP chars; | ||
318 | * echo input chars; | ||
319 | * echo BS-SP-BS on erase character; | ||
320 | * echo kill char specially, not as ^c (ECHOKE controls how exactly); | ||
321 | * erase all input via BS-SP-BS on kill char (else go to next line) | ||
322 | */ | ||
293 | G.termios.c_lflag |= ICANON | ISIG | ECHO | ECHOE | ECHOK | ECHOKE; | 323 | G.termios.c_lflag |= ICANON | ISIG | ECHO | ECHOE | ECHOK | ECHOKE; |
294 | /* echo ctrl chars as ^c; (what is ECHOPRT?) */ | 324 | /* Other bits in c_lflag: |
295 | /* no longer in c_lflag: | ECHOCTL | ECHOPRT */ | 325 | * XCASE Map uppercase to \lowercase [tried, doesn't work] |
326 | * ECHONL Echo NL even if ECHO is not set | ||
327 | * NOFLSH Don't flush input buffer after interrupt or quit chars | ||
328 | * IEXTEN Enable extended functions (??) | ||
329 | * [glibc says it enables c_cc[LNEXT] "enter literal char" | ||
330 | * and c_cc[VDISCARD] "toggle discard buffered output" chars] | ||
331 | * ECHOCTL Echo ctrl chars as ^c (else don't echo) - maybe set this? | ||
332 | * ECHOPRT On erase, echo erased chars | ||
333 | * [qwe<BS><BS><BS> input looks like "qwe\ewq/" on screen] | ||
334 | * FLUSHO Output being flushed (c_cc[VDISCARD] is in effect) | ||
335 | * PENDIN Retype pending input at next read or input char | ||
336 | * (c_cc[VREPRINT] is being processes) | ||
337 | * TOSTOP Send SIGTTOU for background output | ||
338 | * (why "stty sane" unsets this bit?) | ||
339 | */ | ||
296 | 340 | ||
297 | G.termios.c_cc[VINTR] = DEF_INTR; | 341 | G.termios.c_cc[VINTR] = DEF_INTR; |
298 | G.termios.c_cc[VQUIT] = DEF_QUIT; | 342 | G.termios.c_cc[VQUIT] = DEF_QUIT; |
@@ -305,6 +349,14 @@ static void termios_final(void) | |||
305 | G.termios.c_cc[VSWTCH] = DEF_SWITCH; | 349 | G.termios.c_cc[VSWTCH] = DEF_SWITCH; |
306 | #endif | 350 | #endif |
307 | G.termios.c_cc[VKILL] = DEF_KILL; | 351 | G.termios.c_cc[VKILL] = DEF_KILL; |
352 | /* Other control chars: | ||
353 | * VEOL2 | ||
354 | * VERASE, VWERASE - (word) erase. we may set VERASE in get_logname | ||
355 | * VREPRINT - reprint current input buffer | ||
356 | * VLNEXT, VDISCARD, VSTATUS | ||
357 | * VSUSP, VDSUSP - send (delayed) SIGTSTP | ||
358 | * VSTART, VSTOP - chars used for IXON/IXOFF | ||
359 | */ | ||
308 | 360 | ||
309 | if (tcsetattr_stdin_TCSANOW(&G.termios) < 0) | 361 | if (tcsetattr_stdin_TCSANOW(&G.termios) < 0) |
310 | bb_perror_msg_and_die("tcsetattr"); | 362 | bb_perror_msg_and_die("tcsetattr"); |