From ba86d619fa41fded96391b712eaa00c5db0a57a4 Mon Sep 17 00:00:00 2001 From: Thomas Treffner Date: Sun, 30 May 2021 07:10:32 +0200 Subject: [PATCH] builtin: fix print/println on termux (#10253) --- vlib/builtin/builtin.c.v | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/vlib/builtin/builtin.c.v b/vlib/builtin/builtin.c.v index 9a84fdf1dd..33597b7864 100644 --- a/vlib/builtin/builtin.c.v +++ b/vlib/builtin/builtin.c.v @@ -164,9 +164,10 @@ pub fn eprint(s string) { // print prints a message to stdout. Unlike `println` stdout is not automatically flushed. // A call to `flush()` will flush the output buffer to stdout. pub fn print(s string) { - $if android { + $if android { // android print for logcat C.fprintf(C.stdout, c'%.*s', s.len, s.str) - } $else $if ios { + } + $if ios { // no else if because we also need console output on android // TODO: Implement a buffer as NSLog doesn't have a "print" C.WrappedNSLog(s.str) } $else $if freestanding { @@ -190,9 +191,10 @@ pub fn println(s string) { } return } - $if android { + $if android { // android print for logcat C.fprintf(C.stdout, c'%.*s\n', s.len, s.str) - } $else $if ios { + } + $if ios { // no else if because we also need console output on android C.WrappedNSLog(s.str) } $else $if freestanding { bare_print(s.str, u64(s.len))