Line 34... |
Line 34... |
#include <stdio.h> /* sprintf() */
|
#include <stdio.h> /* sprintf() */
|
#include <stdlib.h> /* kill(), on_exit() */
|
#include <stdlib.h> /* kill(), on_exit() */
|
#include <unistd.h> /* close() */
|
#include <unistd.h> /* close() */
|
#include <fcntl.h> /* O_RDWR */
|
#include <fcntl.h> /* O_RDWR */
|
#include <string.h> /* strchr() */
|
#include <string.h> /* strchr() */
|
|
|
|
#ifndef __CYGWIN__
|
#include <sys/stropts.h> /* grantpt(), unlockpt() */
|
#include <sys/stropts.h> /* grantpt(), unlockpt() */
|
|
#include <libgen.h> /* basename() */
|
|
#endif /* __CYGWIN__ */
|
|
|
#include <termios.h> /* struct termios and al. */
|
#include <termios.h> /* struct termios and al. */
|
#include <signal.h> /* signal() and al. */
|
#include <signal.h> /* signal() and al. */
|
#include <libgen.h> /* basename() */
|
|
#include <errno.h> /* errno and al. */
|
#include <errno.h> /* errno and al. */
|
|
|
#include "channel.h"
|
#include "channel.h"
|
#include "generic.h"
|
#include "generic.h"
|
#include "fd.h"
|
#include "fd.h"
|
|
|
|
|
|
|
struct xterm_channel
|
struct xterm_channel
|
{
|
{
|
struct fd_channel fds;
|
struct fd_channel fds;
|
int pid;
|
int pid;
|
char** argv;
|
char** argv;
|
};
|
};
|
|
|
|
#ifdef __CYGWIN__
|
|
char *basename(const char *filename)
|
|
{
|
|
char *p = strrchr (filename, '/');
|
|
|
|
return p ? p + 1 : (char *) filename;
|
|
}
|
|
#endif /* __CYGWIN__ */
|
|
|
static void xterm_close(void * data)
|
static void xterm_close(void * data)
|
{
|
{
|
struct xterm_channel * xt = data;
|
struct xterm_channel * xt = data;
|
|
|
Line 154... |
Line 164... |
}
|
}
|
|
|
xt->fds.fdout = xt->fds.fdin = open(slavename, O_RDWR);
|
xt->fds.fdout = xt->fds.fdin = open(slavename, O_RDWR);
|
if(xt->fds.fdout < 0) goto closemastererror;
|
if(xt->fds.fdout < 0) goto closemastererror;
|
|
|
#ifndef linux
|
#if !defined(linux) && !defined(__CYGWIN__)
|
/* Linux does not support STREAMS-style line discipline, even with LiS. */
|
/* Linux does not support STREAMS-style line discipline, even with LiS. */
|
retval = ioctl(xt->fds.fdin, I_PUSH, "ptem");
|
retval = ioctl(xt->fds.fdin, I_PUSH, "ptem");
|
if(retval < 0) goto closeslaveerror;
|
if(retval < 0) goto closeslaveerror;
|
|
|
retval = ioctl(xt->fds.fdin, I_PUSH, "ldterm");
|
retval = ioctl(xt->fds.fdin, I_PUSH, "ldterm");
|