summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2022-03-14 14:07:20 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2022-03-14 15:17:26 +0100
commit813a96b517ae96716fb018ff93ab2d6a4bbcda95 (patch)
tree669f016ec9dc7d23ca1cdd40bffac9906085df19
parentb6f7a3fe15f2f253a1653454f514b467aa20f821 (diff)
sfeed_curses: use ttywrite() for writing to the tty consistently
This should also suppress a compiler warning of an unchecked write() return value.
-rw-r--r--sfeed_curses.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sfeed_curses.c b/sfeed_curses.c
index 1c6bc24..d0ca7dd 100644
--- a/sfeed_curses.c
+++ b/sfeed_curses.c
@@ -986,7 +986,7 @@ lineeditor(void)
int ch;
for (;;) {
- if (nchars + 1 >= cap) {
+ if (nchars + 2 >= cap) {
cap = cap ? cap * 2 : 32;
input = erealloc(input, cap);
}
@@ -999,11 +999,11 @@ lineeditor(void)
if (!nchars)
continue;
input[--nchars] = '\0';
- write(1, "\b \b", 3); /* back, blank, back */
- continue;
+ ttywrite("\b \b"); /* back, blank, back */
} else if (ch >= ' ') {
input[nchars] = ch;
- write(1, &input[nchars], 1);
+ input[nchars + 1] = '\0';
+ ttywrite(&input[nchars]);
nchars++;
} else if (ch < 0) {
switch (sigstate) {