use write_str() functions where appropriate

function                                             old     new   delta
chat_main                                           1300    1295      -5
finalize_tty_attrs                                    80      70     -10
getty_main                                          1538    1519     -19
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-34)             Total: -34 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2020-11-29 11:49:37 +01:00
parent ec16c030bd
commit b86a9ed699
2 changed files with 5 additions and 5 deletions

View File

@ -404,7 +404,7 @@ static void finalize_tty_attrs(void)
set_tty_attrs(); set_tty_attrs();
/* Now the newline character should be properly written */ /* Now the newline character should be properly written */
full_write(STDOUT_FILENO, "\n", 1); full_write1_str("\n");
} }
/* extract baud rate from modem status message */ /* extract baud rate from modem status message */
@ -498,13 +498,13 @@ static char *get_logname(void)
case 0x7f: case 0x7f:
G.tty_attrs.c_cc[VERASE] = c; G.tty_attrs.c_cc[VERASE] = c;
if (bp > G.line_buf) { if (bp > G.line_buf) {
full_write(STDOUT_FILENO, "\010 \010", 3); full_write1_str("\010 \010");
bp--; bp--;
} }
break; break;
case CTL('U'): case CTL('U'):
while (bp > G.line_buf) { while (bp > G.line_buf) {
full_write(STDOUT_FILENO, "\010 \010", 3); full_write1_str("\010 \010");
bp--; bp--;
} }
break; break;

View File

@ -379,7 +379,7 @@ int chat_main(int argc UNUSED_PARAM, char **argv)
// dump device input if ECHO ON // dump device input if ECHO ON
if (echo) { if (echo) {
// if (buf[buf_len] < ' ') { // if (buf[buf_len] < ' ') {
// full_write(STDERR_FILENO, "^", 1); // full_write2_str("^");
// buf[buf_len] += '@'; // buf[buf_len] += '@';
// } // }
full_write(STDERR_FILENO, buf+buf_len, 1); full_write(STDERR_FILENO, buf+buf_len, 1);
@ -509,7 +509,7 @@ int chat_main(int argc UNUSED_PARAM, char **argv)
#if ENABLE_FEATURE_CHAT_IMPLICIT_CR #if ENABLE_FEATURE_CHAT_IMPLICIT_CR
// or terminate command with \r (if not inhibited) // or terminate command with \r (if not inhibited)
else if (!nocr) else if (!nocr)
xwrite(STDOUT_FILENO, "\r", 1); xwrite_str(STDOUT_FILENO, "\r");
#endif #endif
// bail out unless we sent command successfully // bail out unless we sent command successfully
if (exitcode) if (exitcode)