aboutsummaryrefslogtreecommitdiffstats
path: root/libexec_send_document.c
blob: e69ad7248e3a172ea81fa88ee121e9301735529a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* 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