diff --git a/include/alisp/stream.h b/include/alisp/stream.h index a2fbbd8..d5842df 100644 --- a/include/alisp/stream.h +++ b/include/alisp/stream.h @@ -56,6 +56,7 @@ stream_err_t stream_init_pipe(stream_t *, const char *, FILE *); // NOTE: stream_init_file will attempt to read all content from the FILE // descriptor. Use with caution. stream_err_t stream_init_file(stream_t *, const char *, FILE *); +void stream_reset(stream_t *); void stream_stop(stream_t *); // End of Content (i.e. we've consumed all cached content/file) diff --git a/src/stream.c b/src/stream.c index 5397200..d85ef8f 100644 --- a/src/stream.c +++ b/src/stream.c @@ -100,6 +100,13 @@ stream_err_t stream_init_file(stream_t *stream, const char *name, FILE *pipe) return STREAM_ERR_OK; } +void stream_reset(stream_t *stream) +{ + if (!stream) + return; + stream->position = 0; +} + void stream_stop(stream_t *stream) { if (!stream)