From 9df691e1aff80249209dc9b4918eb94310d5fb3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 10 Jul 2019 16:03:18 +0200 Subject: [PATCH] vt: add vt_param_get() - returns the specified parameter's value --- vt.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vt.h b/vt.h index 8652e341..0e85a75b 100644 --- a/vt.h +++ b/vt.h @@ -6,3 +6,14 @@ #include "terminal.h" void vt_from_slave(struct terminal *term, const uint8_t *data, size_t len); + +static inline int +vt_param_get(const struct terminal *term, size_t idx, int default_value) +{ + if (term->vt.params.idx > idx) { + int value = term->vt.params.v[idx].value; + return value != 0 ? value : default_value; + } + + return default_value; +}