mirror of
https://github.com/apache/nuttx.git
synced 2025-12-08 10:55:51 +08:00
libc/stream:add putc interface for mtd/blk stream.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
This commit is contained in:
@@ -127,6 +127,16 @@ static int blkoutstream_puts(FAR struct lib_outstream_s *this,
|
||||
return len;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: blkoutstream_putc
|
||||
****************************************************************************/
|
||||
|
||||
static void blkoutstream_putc(FAR struct lib_outstream_s *this, int ch)
|
||||
{
|
||||
char tmp = ch;
|
||||
blkoutstream_puts(this, &tmp, 1);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -217,6 +227,7 @@ int lib_blkoutstream_open(FAR struct lib_blkoutstream_s *stream,
|
||||
}
|
||||
|
||||
stream->inode = inode;
|
||||
stream->public.put = blkoutstream_putc;
|
||||
stream->public.puts = blkoutstream_puts;
|
||||
stream->public.flush = blkoutstream_flush;
|
||||
|
||||
|
||||
@@ -194,6 +194,16 @@ static int mtdoutstream_puts(FAR struct lib_outstream_s *this,
|
||||
return len;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: mtdoutstream_putc
|
||||
****************************************************************************/
|
||||
|
||||
static void mtdoutstream_putc(FAR struct lib_outstream_s *this, int ch)
|
||||
{
|
||||
char tmp = ch;
|
||||
mtdoutstream_puts(this, &tmp, 1);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -292,6 +302,7 @@ int lib_mtdoutstream_open(FAR struct lib_mtdoutstream_s *stream,
|
||||
}
|
||||
|
||||
stream->inode = node;
|
||||
stream->public.put = mtdoutstream_putc;
|
||||
stream->public.puts = mtdoutstream_puts;
|
||||
stream->public.flush = mtdoutstream_flush;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user