X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/59ef69ba619917734a8713db0db842ae3edd6086..f622e663e7fcfb9ad92651e1a277d325dd939e5c:/lib/sink.h diff --git a/lib/sink.h b/lib/sink.h index ff763a6..fc99d6b 100644 --- a/lib/sink.h +++ b/lib/sink.h @@ -115,6 +115,29 @@ static inline int sink_err(struct sink *s) { return s->error(s); } +struct source { + int (*getch)(struct source *s); + int (*error)(struct source *s); + int (*eof)(struct source *s); + + enum error_class eclass; +}; + +struct source *source_stdio(FILE *fp); +struct source *source_socketio(struct socketio *sio); + +static inline int source_getc(struct source *s) { + return s->getch(s); +} + +static inline int source_err(struct source *s) { + return s->error(s); +} + +static inline int source_eof(struct source *s) { + return s->eof(s); +} + #endif /* SINK_H */ /*