+/** Convenience function factored out from readbody():
+ * send buffer \a buf via stuffline() and handle errors and progress.
+ * Store return value in \a *n, and return PS_IOERR for failure or
+ * PS_SUCCESS otherwise. */
+static int rb_send(struct query *ctl, char *buf, int *n)
+{
+ *n = stuffline(ctl, buf);
+
+ if (*n < 0)
+ {
+ report(stdout, GT_("error writing message text\n"));
+ release_sink(ctl);
+ return(PS_IOERR);
+ }
+ else if (want_progress())
+ {
+ fputc('*', stdout);
+ fflush(stdout);
+ }
+ return PS_SUCCESS;
+}
+