libc/stream:add putc interface for mtd/blk stream.

Signed-off-by: 田昕 <tianxin7@xiaomi.com>
This commit is contained in:
田昕 2022-11-28 14:51:52 +08:00 committed by Xiang Xiao
parent 139663ba89
commit 9d48d86606
2 changed files with 22 additions and 0 deletions

View File

@ -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;

View File

@ -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;