You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/02/25 10:39:35 UTC

[nuttx] 01/03: libc/stream: Implement lowoutstream_puts

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 8d16fa04df49fa211feb6d7a63ed5bb0e7dfa59d
Author: yinshengkai <yi...@xiaomi.com>
AuthorDate: Fri Feb 24 11:37:35 2023 +0800

    libc/stream: Implement lowoutstream_puts
    
    Signed-off-by: yinshengkai <yi...@xiaomi.com>
---
 libs/libc/stream/lib_lowoutstream.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libs/libc/stream/lib_lowoutstream.c b/libs/libc/stream/lib_lowoutstream.c
index 8a9e2a8342..0000dda8f6 100644
--- a/libs/libc/stream/lib_lowoutstream.c
+++ b/libs/libc/stream/lib_lowoutstream.c
@@ -51,6 +51,20 @@ static void lowoutstream_putc(FAR struct lib_outstream_s *this, int ch)
     }
 }
 
+/****************************************************************************
+ * Name: lowoutstream_puts
+ ****************************************************************************/
+
+static int lowoutstream_puts(FAR struct lib_outstream_s *this,
+                             FAR const void *buf, int len)
+{
+  DEBUGASSERT(this);
+
+  this->nput += len;
+  up_nputs(buf, len);
+  return len;
+}
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -73,6 +87,7 @@ static void lowoutstream_putc(FAR struct lib_outstream_s *this, int ch)
 void lib_lowoutstream(FAR struct lib_outstream_s *stream)
 {
   stream->putc  = lowoutstream_putc;
+  stream->puts  = lowoutstream_puts;
   stream->flush = lib_noflush;
   stream->nput  = 0;
 }