Richard B's patch to add WINDOWID support to pterm.
[sgt/putty] / unix / pty.c
index 1c213e8..63fe69e 100644 (file)
@@ -394,6 +394,7 @@ static char *pty_init(void *frontend, void **backend_handle, Config *cfg,
 {
     int slavefd;
     pid_t pid, pgrp;
+    long windowid;
 
     pty_frontend = frontend;
     *backend_handle = NULL;           /* we can't sensibly use this, sadly */
@@ -435,6 +436,8 @@ static char *pty_init(void *frontend, void **backend_handle, Config *cfg,
        }
     }
 
+    windowid = get_windowid(pty_frontend);
+
     /*
      * Fork and execute the command.
      */
@@ -476,6 +479,11 @@ static char *pty_init(void *frontend, void **backend_handle, Config *cfg,
            sprintf(term_env_var, "TERM=%s", cfg->termtype);
            putenv(term_env_var);
        }
+       {
+           char windowid_env_var[40];
+           sprintf(windowid_env_var, "WINDOWID=%ld", windowid);
+           putenv(windowid_env_var);
+       }
        /*
         * SIGINT and SIGQUIT may have been set to ignored by our
         * parent, particularly by things like sh -c 'pterm &' and
@@ -519,6 +527,14 @@ static void pty_reconfig(void *handle, Config *cfg)
 }
 
 /*
+ * Stub routine (never called in pterm
+ */
+static void pty_free(void *handle)
+{
+}
+
+
+/*
  * Called to send data down the pty.
  */
 static int pty_send(void *handle, char *buf, int len)
@@ -624,6 +640,7 @@ static int pty_exitcode(void *handle)
 
 Backend pty_backend = {
     pty_init,
+    pty_free,
     pty_reconfig,
     pty_send,
     pty_sendbuffer,