aboutsummaryrefslogtreecommitdiffstats
path: root/libterminput_unmarshal_text__.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libterminput_unmarshal_text__.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libterminput_unmarshal_text__.c b/libterminput_unmarshal_text__.c
new file mode 100644
index 0000000..be9bb10
--- /dev/null
+++ b/libterminput_unmarshal_text__.c
@@ -0,0 +1,16 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+
+
+int
+libterminput_unmarshal_text__(struct libterminput_unmarshaller *how, struct libterminput_text *what)
+{
+ 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);
+}