version 1.1, 2002/09/03 00:41:44 |
version 1.3, 2002/09/18 10:03:28 |
Line 10 static char rcsid[]= |
|
Line 10 static char rcsid[]= |
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <sys/stat.h> |
#include <sys/ioctl.h> |
#include <sys/ioctl.h> |
|
#if defined(sun) |
|
#include <sys/fcntl.h> |
|
#include <sys/ttold.h> |
|
#endif |
#ifdef TERMIOS |
#ifdef TERMIOS |
#include <termios.h> |
#include <termios.h> |
#if defined(__linux__) || defined(__CYGWIN__) |
#if defined(__linux__) || defined(__CYGWIN__) |
Line 57 int histlen = -1; /* history length */ |
|
Line 61 int histlen = -1; /* history length */ |
|
int debug = OFF; /* debug switch */ |
int debug = OFF; /* debug switch */ |
int auto_tty_fix = ON; /* fix tty mode automaticaly */ |
int auto_tty_fix = ON; /* fix tty mode automaticaly */ |
FILE *script_fp = NULL; /* script file pointer */ |
FILE *script_fp = NULL; /* script file pointer */ |
|
#if defined(sun) |
|
void catchsig (int); /* function take care SIGCHILD */ |
|
#else |
void catchsig __P((int)); /* function take care SIGCHILD */ |
void catchsig __P((int)); /* function take care SIGCHILD */ |
|
#endif |
|
|
#ifdef TERMIOS |
#ifdef TERMIOS |
#define ttystruct termios |
#define ttystruct termios |
Line 72 int lines; /* terminal line size */ |
|
Line 80 int lines; /* terminal line size */ |
|
int columns; /* terminal coulumn size */ |
int columns; /* terminal coulumn size */ |
char *term_clear; /* terminal clear code */ |
char *term_clear; /* terminal clear code */ |
|
|
|
#if defined(sun) |
|
void (*sighup)(int), (*sigchld)(int), (*sigtstp)(int); |
|
#else |
void (*sighup) __P((int)), (*sigchld) __P((int)), (*sigtstp) __P((int)); |
void (*sighup) __P((int)), (*sigchld) __P((int)), (*sigtstp) __P((int)); |
|
#endif |
/* function buffer for signal */ |
/* function buffer for signal */ |
|
|
#ifdef TIOCSETN |
#ifdef TIOCSETN |
|
|
fix_signal () |
fix_signal () |
{ |
{ |
#ifdef SIGWINCH |
#ifdef SIGWINCH |
|
#if defined(sun) |
|
void sigwinch (int); |
|
#else |
void sigwinch __P((int)); |
void sigwinch __P((int)); |
#endif |
#endif |
|
#endif |
|
|
sighup = signal (SIGHUP, terminate); |
sighup = signal (SIGHUP, terminate); |
sigchld = signal (SIGCHLD, catchsig); |
sigchld = signal (SIGCHLD, catchsig); |
Line 839 get_pty_master() |
|
Line 855 get_pty_master() |
|
return; |
return; |
} |
} |
#ifdef __CYGWIN32__ |
#ifdef __CYGWIN32__ |
for (i = 0; i < 16; i++) { |
sprintf (master_tty, "/dev/ptmx"); |
sprintf (master_tty, "/dev/ptmx"); |
master = open (master_tty, O_RDWR); |
master = open (master_tty, O_RDWR); |
if (master >= 0) { |
if (master >= 0) { |
char *name; |
sprintf (slave_tty, "/dev/tty%x",i); |
name = (char *)ptsname(master); |
|
if ( name != 0 ) { |
|
strcpy(slave_tty, name); |
goto FOUND; |
goto FOUND; |
} |
} |
} |
} |
|
|
suspend() |
suspend() |
{ |
{ |
long pid; |
long pid; |
|
#if defined(sun) |
|
void (*func) (int); |
|
#else |
void (*func) __P((int)); |
void (*func) __P((int)); |
|
#endif |
#ifndef __CYGWIN32__ |
#ifndef __CYGWIN32__ |
int omask; |
int omask; |
#endif |
#endif |
|
|
signal (SIGTSTP, SIG_DFL); |
signal (SIGTSTP, SIG_DFL); |
recover_tty(); |
recover_tty(); |
#define mask(s) (1 << ((s)-1)) |
#define mask(s) (1 << ((s)-1)) |
#ifndef __CYGWIN32__ |
#if !defined(__CYGWIN32__) && !defined(sun) |
omask = sigsetmask (sigblock (0) & ~mask (SIGTSTP)); |
omask = sigsetmask (sigblock (0) & ~mask (SIGTSTP)); |
#endif |
#endif |
kill (0, SIGTSTP); |
kill (0, SIGTSTP); |
|
|
kill (0, SIGCONT); |
kill (0, SIGCONT); |
signal (SIGCHLD, func); |
signal (SIGCHLD, func); |
signal (SIGTSTP, SIG_IGN); |
signal (SIGTSTP, SIG_IGN); |
#ifndef __CYGWIN32__ |
#if !defined(__CYGWIN32__) && !defined(sun) |
sigblock (mask (SIGTSTP)); |
sigblock (mask (SIGTSTP)); |
#endif |
#endif |
fix_tty (); |
fix_tty (); |