[vte/vte-next] pty: Set env var with vte version
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/vte-next] pty: Set env var with vte version
- Date: Thu, 9 May 2013 13:54:42 +0000 (UTC)
commit c1e189d92dd3ed653c28bf17a2b154f8e506e308
Author: Christian Persch <chpe gnome org>
Date: Sun Apr 21 19:02:26 2013 +0200
pty: Set env var with vte version
This is necessary so that we'll be able to check whether to use the
vte.sh script in PS1.
(cherry picked from commit 8bea17d1a36abb635e751e4daf4315b0bf20b26e)
src/pty.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/pty.c b/src/pty.c
index 83c6dc0..ac87af5 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -31,6 +31,7 @@
#include "vtepty.h"
#include "vtepty-private.h"
#include "vte.h"
+#include "vteversion.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -88,6 +89,8 @@ static int _vte_pty_helper_tunnel = -1;
#undef HAVE_UNIX98_PTY
#endif
+#define VTE_VERSION_NUMERIC ((VTE_MAJOR_VERSION) * 10000 + (VTE_MINOR_VERSION) * 100 + (VTE_MICRO_VERSION))
+
/* Reset the handlers for all known signals to their defaults. The parent
* (or one of the libraries it links to) may have changed one to be ignored. */
static void
@@ -245,6 +248,7 @@ vte_pty_child_setup (VtePty *pty)
VtePtyChildSetupData *data = &priv->child_setup_data;
int fd = -1;
const char *tty = NULL;
+ char version[7];
if (priv->foreign) {
fd = priv->pty_fd;
@@ -347,6 +351,9 @@ vte_pty_child_setup (VtePty *pty)
g_setenv("TERM", priv->term, TRUE);
}
+ g_snprintf (version, sizeof (version), "%u", VTE_VERSION_NUMERIC);
+ g_setenv ("VTE", version, TRUE);
+
/* Finally call an extra child setup */
if (data->extra_child_setup) {
data->extra_child_setup (data->extra_child_setup_data);
@@ -400,6 +407,8 @@ __vte_pty_merge_environ (char **envp, const char *term_value)
if (term_value != NULL)
g_hash_table_replace (table, g_strdup ("TERM"), g_strdup (term_value));
+ g_hash_table_replace (table, g_strdup ("VTE"), g_strdup_printf ("%u", VTE_VERSION_NUMERIC));
+
array = g_ptr_array_sized_new (g_hash_table_size (table) + 1);
g_hash_table_iter_init(&iter, table);
while (g_hash_table_iter_next(&iter, (gpointer) &name, (gpointer) &value)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]