libc/streams: Add lib_[si]gets_t callback

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-11-24 17:42:06 +08:00 committed by archer
parent 5ee1da4211
commit 90c641d4c1

View File

@ -52,6 +52,8 @@
struct lib_instream_s;
typedef CODE int (*lib_getc_t)(FAR struct lib_instream_s *this);
typedef CODE int (*lib_gets_t)(FAR struct lib_instream_s *this,
FAR void *buf, int len);
struct lib_outstream_s;
typedef CODE void (*lib_putc_t)(FAR struct lib_outstream_s *this, int ch);
@ -64,6 +66,7 @@ struct lib_instream_s
int nget; /* Total number of characters gotten. Written
* by get method, readable by user */
lib_getc_t get; /* Get one character from the instream */
lib_gets_t gets; /* Get the string from the instream */
};
struct lib_outstream_s
@ -79,6 +82,8 @@ struct lib_outstream_s
struct lib_sistream_s;
typedef CODE int (*lib_sigetc_t)(FAR struct lib_sistream_s *this);
typedef CODE int (*lib_sigets_t)(FAR struct lib_sistream_s *this,
FAR void *buf, int len);
typedef CODE off_t (*lib_siseek_t)(FAR struct lib_sistream_s *this,
off_t offset, int whence);
@ -95,6 +100,7 @@ struct lib_sistream_s
int nget; /* Total number of characters gotten. Written
* by get method, readable by user */
lib_sigetc_t get; /* Get one character from the instream */
lib_gets_t gets; /* Get the string from the instream */
lib_siseek_t seek; /* Seek to a position in the instream */
};