+/* discard sink **************************************************************/
+
+static int sink_discard_write(struct sink attribute((unused)) *s,
+ const void attribute((unused)) *buffer,
+ int nbytes) {
+ return nbytes;
+}
+
+/** @brief Return a sink which discards all output */
+struct sink *sink_discard(void) {
+ struct sink *s = xmalloc(sizeof *s);
+
+ s->write = sink_discard_write;
+ return s;
+}
+
+/* error sink **************************************************************/
+
+static int sink_error_write(struct sink attribute((unused)) *s,
+ const void attribute((unused)) *buffer,
+ int attribute((unused)) nbytes) {
+ return -1;
+}
+
+/** @brief Return a sink which discards all output */
+struct sink *sink_error(void) {
+ struct sink *s = xmalloc(sizeof *s);
+
+ s->write = sink_error_write;
+ return s;
+}
+