summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-06-12 15:43:17 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2013-06-12 15:43:17 +0200
commit066cf5144595638b8e70b97add195c7e648ecca3 (patch)
tree2cf539e2f970a81fd6abb0a5cf33732a6421a5e4 /src
parent3d2d8f5984a5bb9443d9904be8e4d2e4bd94991a (diff)
uterm: vt: add uterm_vt_get_num() helper
This helper returns the VT-number for the given VT if, and only if, it is a real VT. In all other cases 0 is returned. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/uterm_vt.c12
-rw-r--r--src/uterm_vt.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/uterm_vt.c b/src/uterm_vt.c
index d0f18ea..af377f5 100644
--- a/src/uterm_vt.c
+++ b/src/uterm_vt.c
@@ -986,6 +986,18 @@ unsigned int uterm_vt_get_type(struct uterm_vt *vt)
}
SHL_EXPORT
+unsigned int uterm_vt_get_num(struct uterm_vt *vt)
+{
+ if (!vt)
+ return 0;
+
+ if (vt->mode == UTERM_VT_REAL)
+ return vt->real_num;
+
+ return 0;
+}
+
+SHL_EXPORT
int uterm_vt_master_new(struct uterm_vt_master **out,
struct ev_eloop *eloop)
{
diff --git a/src/uterm_vt.h b/src/uterm_vt.h
index 0362bbe..1370c12 100644
--- a/src/uterm_vt.h
+++ b/src/uterm_vt.h
@@ -85,5 +85,6 @@ int uterm_vt_activate(struct uterm_vt *vt);
int uterm_vt_deactivate(struct uterm_vt *vt);
void uterm_vt_retry(struct uterm_vt *vt);
unsigned int uterm_vt_get_type(struct uterm_vt *vt);
+unsigned int uterm_vt_get_num(struct uterm_vt *vt);
#endif /* UTERM_UTERM_VT_H */