diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-24 18:17:19 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-24 18:17:19 +0100 |
commit | 7073964b5fc01fbe83eee17e52a2341b19cf11c5 (patch) | |
tree | 55e693c361b2948ce83dfbbdcd75c096c80eab11 | |
parent | 6b1ce455986ae547b9a0e1e238b90ba2a928599b (diff) | |
download | busybox-w32-7073964b5fc01fbe83eee17e52a2341b19cf11c5.tar.gz busybox-w32-7073964b5fc01fbe83eee17e52a2341b19cf11c5.tar.bz2 busybox-w32-7073964b5fc01fbe83eee17e52a2341b19cf11c5.zip |
getty: simplify macros; improve VSWTC[H] compat
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | loginutils/getty.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c index 402e1c097..ed7e09aca 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -68,19 +68,16 @@ static FILE *dbf; | |||
68 | 68 | ||
69 | /* Some shorthands for control characters */ | 69 | /* Some shorthands for control characters */ |
70 | #define CTL(x) ((x) ^ 0100) /* Assumes ASCII dialect */ | 70 | #define CTL(x) ((x) ^ 0100) /* Assumes ASCII dialect */ |
71 | #define CR CTL('M') /* carriage return */ | ||
72 | #define NL CTL('J') /* line feed */ | ||
73 | #define BS CTL('H') /* back space */ | 71 | #define BS CTL('H') /* back space */ |
74 | #define DEL CTL('?') /* delete */ | 72 | #define DEL CTL('?') /* delete */ |
75 | 73 | ||
76 | /* Defaults for line-editing etc. characters; you may want to change this */ | 74 | /* Defaults for line-editing etc. characters; you may want to change this */ |
77 | #define DEF_ERASE DEL /* default erase character */ | ||
78 | #define DEF_INTR CTL('C') /* default interrupt character */ | 75 | #define DEF_INTR CTL('C') /* default interrupt character */ |
79 | #define DEF_QUIT CTL('\\') /* default quit char */ | 76 | #define DEF_QUIT CTL('\\') /* default quit char */ |
80 | #define DEF_KILL CTL('U') /* default kill char */ | 77 | #define DEF_KILL CTL('U') /* default kill char */ |
81 | #define DEF_EOF CTL('D') /* default EOF char */ | 78 | #define DEF_EOF CTL('D') /* default EOF char */ |
82 | #define DEF_EOL '\n' | 79 | #define DEF_EOL '\n' |
83 | #define DEF_SWITCH 0 /* default switch char */ | 80 | #define DEF_SWITCH 0 /* default switch char (none) */ |
84 | 81 | ||
85 | /* | 82 | /* |
86 | * When multiple baud rates are specified on the command line, | 83 | * When multiple baud rates are specified on the command line, |
@@ -293,9 +290,12 @@ static void termios_final(void) | |||
293 | #ifdef VSWTC | 290 | #ifdef VSWTC |
294 | G.termios.c_cc[VSWTC] = DEF_SWITCH; | 291 | G.termios.c_cc[VSWTC] = DEF_SWITCH; |
295 | #endif | 292 | #endif |
293 | #ifdef VSWTCH | ||
294 | G.termios.c_cc[VSWTCH] = DEF_SWITCH; | ||
295 | #endif | ||
296 | 296 | ||
297 | /* Account for special characters seen in input */ | 297 | /* Account for special characters seen in input */ |
298 | if (G.eol == CR) { | 298 | if (G.eol == '\r') { |
299 | G.termios.c_iflag |= ICRNL; /* map CR in input to NL */ | 299 | G.termios.c_iflag |= ICRNL; /* map CR in input to NL */ |
300 | /* already done by termios_init */ | 300 | /* already done by termios_init */ |
301 | /* G.termios.c_oflag |= ONLCR; map NL in output to CR-NL */ | 301 | /* G.termios.c_oflag |= ONLCR; map NL in output to CR-NL */ |
@@ -406,8 +406,8 @@ static char *get_logname(void) | |||
406 | 406 | ||
407 | /* Do erase, kill and end-of-line processing */ | 407 | /* Do erase, kill and end-of-line processing */ |
408 | switch (c) { | 408 | switch (c) { |
409 | case CR: | 409 | case '\r': |
410 | case NL: | 410 | case '\n': |
411 | *bp = '\0'; | 411 | *bp = '\0'; |
412 | G.eol = c; | 412 | G.eol = c; |
413 | goto got_logname; | 413 | goto got_logname; |
@@ -456,7 +456,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv) | |||
456 | #ifdef ISSUE | 456 | #ifdef ISSUE |
457 | G.issue = ISSUE; /* default issue file */ | 457 | G.issue = ISSUE; /* default issue file */ |
458 | #endif | 458 | #endif |
459 | G.eol = CR; | 459 | G.eol = '\r'; |
460 | 460 | ||
461 | /* Parse command-line arguments */ | 461 | /* Parse command-line arguments */ |
462 | parse_args(argv); | 462 | parse_args(argv); |
@@ -545,7 +545,6 @@ int getty_main(int argc UNUSED_PARAM, char **argv) | |||
545 | /* Optionally wait for CR or LF before writing /etc/issue */ | 545 | /* Optionally wait for CR or LF before writing /etc/issue */ |
546 | if (option_mask32 & F_WAITCRLF) { | 546 | if (option_mask32 & F_WAITCRLF) { |
547 | char ch; | 547 | char ch; |
548 | |||
549 | debug("waiting for cr-lf\n"); | 548 | debug("waiting for cr-lf\n"); |
550 | while (safe_read(STDIN_FILENO, &ch, 1) == 1) { | 549 | while (safe_read(STDIN_FILENO, &ch, 1) == 1) { |
551 | debug("read %x\n", (unsigned char)ch); | 550 | debug("read %x\n", (unsigned char)ch); |