libc/stream:add putc interface for mtd/blk stream.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
This commit is contained in:
parent
139663ba89
commit
9d48d86606
@ -127,6 +127,16 @@ static int blkoutstream_puts(FAR struct lib_outstream_s *this,
|
|||||||
return len;
|
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
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -217,6 +227,7 @@ int lib_blkoutstream_open(FAR struct lib_blkoutstream_s *stream,
|
|||||||
}
|
}
|
||||||
|
|
||||||
stream->inode = inode;
|
stream->inode = inode;
|
||||||
|
stream->public.put = blkoutstream_putc;
|
||||||
stream->public.puts = blkoutstream_puts;
|
stream->public.puts = blkoutstream_puts;
|
||||||
stream->public.flush = blkoutstream_flush;
|
stream->public.flush = blkoutstream_flush;
|
||||||
|
|
||||||
|
@ -194,6 +194,16 @@ static int mtdoutstream_puts(FAR struct lib_outstream_s *this,
|
|||||||
return len;
|
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
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -292,6 +302,7 @@ int lib_mtdoutstream_open(FAR struct lib_mtdoutstream_s *stream,
|
|||||||
}
|
}
|
||||||
|
|
||||||
stream->inode = node;
|
stream->inode = node;
|
||||||
|
stream->public.put = mtdoutstream_putc;
|
||||||
stream->public.puts = mtdoutstream_puts;
|
stream->public.puts = mtdoutstream_puts;
|
||||||
stream->public.flush = mtdoutstream_flush;
|
stream->public.flush = mtdoutstream_flush;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user