summaryrefslogtreecommitdiffstats
path: root/linenoise
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-08 23:19:18 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-08 23:19:18 -0700
commit87abcb204ef192cb40939f58dfdceaba9eac2a8e (patch)
treef15b825a9616af538369496095d42b027ec4d341 /linenoise
parent4056f9da2f6828f652e12561d69420468b735547 (diff)
downloadtxr-87abcb204ef192cb40939f58dfdceaba9eac2a8e.tar.gz
txr-87abcb204ef192cb40939f58dfdceaba9eac2a8e.tar.bz2
txr-87abcb204ef192cb40939f58dfdceaba9eac2a8e.zip
linenoise: stray printf on stdout.
* linenoise/linenoise.c (linenoise): Replace printf("\n") with one-character write on ls->ofd.
Diffstat (limited to 'linenoise')
-rw-r--r--linenoise/linenoise.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c
index 4477d8fd..96ab8709 100644
--- a/linenoise/linenoise.c
+++ b/linenoise/linenoise.c
@@ -974,8 +974,11 @@ char *linenoise(lino_t *ls, const char *prompt)
return 0;
count = edit(ls, prompt);
disable_raw_mode(ls);
- if (count != -1 || ls->error == lino_eof)
- printf("\n");
+ if (count != -1 || ls->error == lino_eof) {
+ char nl = '\n';
+ if (write(ls->ofd, &nl, 1) < 0)
+ return 0;
+ }
if (count == -1)
return 0;
return chk_strdup_utf8(ls->data);