aboutsummaryrefslogtreecommitdiff
path: root/vt.h
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-10 14:03:18 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-10 14:03:18 +0000
commit9df691e1aff80249209dc9b4918eb94310d5fb3e (patch)
treebabe4aae74525b9fa4313abc0aa268e63e39207d /vt.h
parentterminal: add term_linefeed() and term_reverse_index() (diff)
vt: add vt_param_get() - returns the specified parameter's value
Diffstat (limited to 'vt.h')
-rw-r--r--vt.h11
1 files changed, 11 insertions, 0 deletions
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;
+}