diff options
author | Simon Glass | 2020-01-27 08:49:54 -0700 |
---|---|---|
committer | Simon Glass | 2020-02-05 19:33:46 -0700 |
commit | b612312816ffe41a3a7616aa00394ffb248cf91e (patch) | |
tree | 25f3590d5b57a8d974eecbb63ce9006f98a14e14 /common/console.c | |
parent | eb7387ae14ef88ecba85d569de978da776ea4f09 (diff) |
console: Add a function to read a line of the output / eof
When recording the console output for testing it is useful to be able to
read the output a line at a time to check that the output is correct. Also
we need to check that we get to the end of the output.
Add a console function to return the next line and another to see how must
data is left.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/console.c')
-rw-r--r-- | common/console.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/console.c b/common/console.c index 168ba60d0d9..7681da19a2f 100644 --- a/common/console.c +++ b/common/console.c @@ -621,6 +621,17 @@ void console_record_reset_enable(void) console_record_reset(); gd->flags |= GD_FLG_RECORD; } + +int console_record_readline(char *str, int maxlen) +{ + return membuff_readline(&gd->console_out, str, maxlen, ' '); +} + +int console_record_avail(void) +{ + return membuff_avail(&gd->console_out); +} + #endif /* test if ctrl-c was pressed */ |