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>
pty: set XDG_VTNR if requested by caller

A caller can now pass a VT-num to the PTY which will get set as XDG_VTNR
in the environment of new childs.

This can be used to tell systemd-logind to associate the session with
the correct VT. But note that this still cannot overwrite VT-associations
if the pty is created from within an existing session.

Reported-by: Thomas Hebb
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
kmscon: pass vtnr to pty so XDG_VTNR is set

We need to correctly set the VTNR for each new pty, otherwise the pty
cannot set the XDG_VTNR correctly. Note that we do this only for real VTs,
that is, vtnr > 0.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>