#include <stdarg.h>
struct dynstr;
+struct socketio;
/** @brief Sink type
*
struct sink *sink_error(void);
/* return a sink which fails all writes */
+struct sink *sink_socketio(struct socketio *sio);
+/* return a sink which writes to a socket */
+
int sink_vprintf(struct sink *s, const char *fmt, va_list ap);
int sink_printf(struct sink *s, const char *fmt, ...)
attribute((format (printf, 2, 3)));
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 */
/*