projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Windows file selectors contain an edit box as well as the Browse
[u/mdw/putty]
/
unix
/
pty.c
diff --git
a/unix/pty.c
b/unix/pty.c
index
8bd20fe
..
63fe69e
100644
(file)
--- a/
unix/pty.c
+++ b/
unix/pty.c
@@
-168,11
+168,13
@@
static void sigchld_handler(int signum)
pid_t pid;
int status;
pid_t pid;
int status;
- pid = waitpid(-1, &status, WNOHANG);
- if (pid == pty_child_pid && (WIFEXITED(status) || WIFSIGNALED(status))) {
- pty_exit_code = status;
- pty_child_dead = TRUE;
- }
+ do {
+ pid = waitpid(-1, &status, WNOHANG);
+ if (pid == pty_child_pid && (WIFEXITED(status) || WIFSIGNALED(status))) {
+ pty_exit_code = status;
+ pty_child_dead = TRUE;
+ }
+ } while(pid > 0);
errno = save_errno;
}
errno = save_errno;
}
@@
-387,17
+389,18
@@
void pty_pre_init(void)
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
-static char *pty_init(void *frontend, void **backend_handle,
+static char *pty_init(void *frontend, void **backend_handle,
Config *cfg,
char *host, int port, char **realhost, int nodelay)
{
int slavefd;
pid_t pid, pgrp;
char *host, int port, char **realhost, int nodelay)
{
int slavefd;
pid_t pid, pgrp;
+ long windowid;
pty_frontend = frontend;
*backend_handle = NULL; /* we can't sensibly use this, sadly */
pty_frontend = frontend;
*backend_handle = NULL; /* we can't sensibly use this, sadly */
- pty_term_width = cfg
.
width;
- pty_term_height = cfg
.
height;
+ pty_term_width = cfg
->
width;
+ pty_term_height = cfg
->
height;
if (pty_master_fd < 0)
pty_open_master();
if (pty_master_fd < 0)
pty_open_master();
@@
-409,7
+412,7
@@
static char *pty_init(void *frontend, void **backend_handle,
{
struct termios attrs;
tcgetattr(pty_master_fd, &attrs);
{
struct termios attrs;
tcgetattr(pty_master_fd, &attrs);
- attrs.c_cc[VERASE] = cfg
.
bksp_is_delete ? '\177' : '\010';
+ attrs.c_cc[VERASE] = cfg
->
bksp_is_delete ? '\177' : '\010';
tcsetattr(pty_master_fd, TCSANOW, &attrs);
}
tcsetattr(pty_master_fd, TCSANOW, &attrs);
}
@@
-417,7
+420,7
@@
static char *pty_init(void *frontend, void **backend_handle,
* Stamp utmp (that is, tell the utmp helper process to do so),
* or not.
*/
* Stamp utmp (that is, tell the utmp helper process to do so),
* or not.
*/
- if (!cfg
.
stamp_utmp)
+ if (!cfg
->
stamp_utmp)
close(pty_utmp_helper_pipe); /* just let the child process die */
else {
char *location = get_x_display(pty_frontend);
close(pty_utmp_helper_pipe); /* just let the child process die */
else {
char *location = get_x_display(pty_frontend);
@@
-433,6
+436,8
@@
static char *pty_init(void *frontend, void **backend_handle,
}
}
}
}
+ windowid = get_windowid(pty_frontend);
+
/*
* Fork and execute the command.
*/
/*
* Fork and execute the command.
*/
@@
-470,10
+475,15
@@
static char *pty_init(void *frontend, void **backend_handle,
for (i = 3; i < 1024; i++)
close(i);
{
for (i = 3; i < 1024; i++)
close(i);
{
- char term_env_var[10 + sizeof(cfg
.
termtype)];
- sprintf(term_env_var, "TERM=%s", cfg
.
termtype);
+ char term_env_var[10 + sizeof(cfg
->
termtype)];
+ sprintf(term_env_var, "TERM=%s", cfg
->
termtype);
putenv(term_env_var);
}
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
/*
* SIGINT and SIGQUIT may have been set to ignored by our
* parent, particularly by things like sh -c 'pterm &' and
@@
-486,7
+496,7
@@
static char *pty_init(void *frontend, void **backend_handle,
else {
char *shell = getenv("SHELL");
char *shellname;
else {
char *shell = getenv("SHELL");
char *shellname;
- if (cfg
.
login_shell) {
+ if (cfg
->
login_shell) {
char *p = strrchr(shell, '/');
shellname = smalloc(2+strlen(shell));
p = p ? p+1 : shell;
char *p = strrchr(shell, '/');
shellname = smalloc(2+strlen(shell));
p = p ? p+1 : shell;
@@
-510,6
+520,21
@@
static char *pty_init(void *frontend, void **backend_handle,
}
/*
}
/*
+ * Stub routine (we don't have any need to reconfigure this backend).
+ */
+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)
* Called to send data down the pty.
*/
static int pty_send(void *handle, char *buf, int len)
@@
-615,6
+640,8
@@
static int pty_exitcode(void *handle)
Backend pty_backend = {
pty_init,
Backend pty_backend = {
pty_init,
+ pty_free,
+ pty_reconfig,
pty_send,
pty_sendbuffer,
pty_size,
pty_send,
pty_sendbuffer,
pty_size,