aboutsummaryrefslogtreecommitdiffstats
path: root/libterminput_unmarshal_text__.c
blob: bb25fe4c11e421b09e5ee9c5d5528e94f639c23e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* See LICENSE file for copyright and license details. */
#include "common.h"


int
libterminput_unmarshal_text__(struct libterminput_unmarshaller *how, struct libterminput_text *what) /* TODO test */
{
	what->type = LIBTERMINPUT_TEXT;
	if (how->load(how, &what->nbytes, sizeof(what->nbytes)))
		return -1;
	if (what->nbytes > sizeof(what->bytes)) {
		errno = EINVAL;
		return -1;
	}
	return how->load(how, what->bytes, what->nbytes);
}