aboutsummaryrefslogblamecommitdiffstats
path: root/libexec_send_document.c
blob: e69ad7248e3a172ea81fa88ee121e9301735529a (plain) (tree)

























                                                                                       
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST


int
libexec_send_document(struct libexec_document *doc)
{
	ssize_t r;
	if (!doc) {
		errno = EINVAL;
		return -1;
	}
	while (doc->offset < doc->length) {
		r = write(doc->fd, &doc->text[doc->offset], doc->length - doc->offset);
		if (r < 0)
			return -1;
		doc->offset += (size_t)r;
	}
	return 0;
}


#else
LIBEXEC_CONST__ int main(void) {return 0;} /* TODO test */
#endif