version 1.11, 2019/12/13 15:41:36 |
version 1.12, 2020/11/01 10:28:22 |
Line 12 static char rcsid[]= |
|
Line 12 static char rcsid[]= |
|
#endif /* lint */ |
#endif /* lint */ |
|
|
#include <stdio.h> |
#include <stdio.h> |
|
#include <unistd.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <signal.h> |
#include <signal.h> |
Line 136 struct cmdinfo { |
|
Line 137 struct cmdinfo { |
|
{0, 0} |
{0, 0} |
}; |
}; |
|
|
main(argc, argv) |
int main(int argc, char *argv[]) |
int argc; |
|
char *argv[]; |
|
{ |
{ |
int i; |
int i; |
char *cp; |
char *cp; |
|
|
#if defined(__INTERIX) |
#if defined(__INTERIX) |
execvp (*commandv, commandv); |
execvp (*commandv, commandv); |
#else |
#else |
execvp (*commandv, commandv, 0); |
execvp (*commandv, commandv); |
#endif |
#endif |
perror (*commandv); |
perror (*commandv); |
exit (1); |
exit (1); |
|
|
input_handler (); |
input_handler (); |
} |
} |
|
|
fix_signal () |
void fix_signal () |
{ |
{ |
#ifdef SIGWINCH |
#ifdef SIGWINCH |
#if defined(sun) |
#if defined(sun) |
|
|
#endif |
#endif |
} |
} |
|
|
recover_signal () |
void recover_signal () |
{ |
{ |
|
|
(void) signal (SIGHUP, sighup); |
(void) signal (SIGHUP, sighup); |
Line 348 recover_signal () |
|
Line 347 recover_signal () |
|
(void) signal (SIGTSTP, sigtstp); |
(void) signal (SIGTSTP, sigtstp); |
} |
} |
|
|
input_handler() |
void input_handler() |
{ |
{ |
char *inputline; |
char *inputline; |
char *mygetline (); |
char *mygetline (); |
Line 433 struct timeval *notimeout[] = { |
|
Line 432 struct timeval *notimeout[] = { |
|
TIMEOUT_FOREVER |
TIMEOUT_FOREVER |
}; |
}; |
|
|
getcharacter() |
int getcharacter() |
{ |
{ |
char c; |
char c; |
int n; |
int n; |
|
|
goto RETRY; |
goto RETRY; |
} |
} |
|
|
int set_buffer (bp, size) |
int set_buffer (BUFFER *bp, int size) |
BUFFER *bp; |
|
int size; |
|
{ |
{ |
char *newbuf; |
char *newbuf; |
|
|
Line 580 int set_buffer (bp, size) |
|
Line 577 int set_buffer (bp, size) |
|
return (1); |
return (1); |
} |
} |
|
|
int buf_read (fd, bp) |
/* int fd; file discriptor */ |
int fd; /* file discriptor */ |
/* BUFFER *bp; buffer pointer */ |
BUFFER *bp; /* buffer pointer */ |
|
|
int buf_read (int fd, BUFFER *bp) |
{ |
{ |
int nbyte; |
int nbyte; |
|
|
Line 620 int buf_read (fd, bp) |
|
Line 618 int buf_read (fd, bp) |
|
return (nbyte); |
return (nbyte); |
} |
} |
|
|
buf_put (bp, s) |
/* |
BUFFER *bp; /* buffer pointer */ |
BUFFER *bp; buffer pointer |
char *s; /* string pointer */ |
char *s; string pointer |
|
*/ |
|
|
|
void buf_put (BUFFER *bp, char *s) |
{ |
{ |
int nbyte; |
int nbyte; |
int slen; |
int slen; |
|
|
} |
} |
} |
} |
|
|
swallow_output() |
void swallow_output() |
{ |
{ |
fd_set readfd = mastermask; |
fd_set readfd = mastermask; |
int r; |
int r; |
Line 693 swallow_output() |
|
Line 694 swallow_output() |
|
#define wait3(s,opt,rp) (waitpid((-1),(s),(opt))) |
#define wait3(s,opt,rp) (waitpid((-1),(s),(opt))) |
#endif |
#endif |
|
|
void |
void catchsig(int n) |
catchsig(n) |
|
int n; |
|
{ |
{ |
int status; |
int status; |
struct rusage ru; |
struct rusage ru; |
|
|
terminate (0); |
terminate (0); |
} |
} |
|
|
exec_to_command(argv) |
void exec_to_command(char *argv[]) |
char *argv[]; |
|
{ |
{ |
int t; |
int t; |
|
|
Line 744 exec_to_command(argv) |
|
Line 742 exec_to_command(argv) |
|
#if defined(__INTERIX) |
#if defined(__INTERIX) |
execvp (*argv, argv); |
execvp (*argv, argv); |
#else |
#else |
execvp (*argv, argv, 0); |
execvp (*argv, argv); |
#endif |
#endif |
perror (*argv); |
perror (*argv); |
exit (1); |
exit (1); |
} |
} |
|
|
#ifdef TERMIOS |
#ifdef TERMIOS |
fix_tty() |
void fix_tty() |
{ |
{ |
int i; |
int i; |
master_ttymode = initial_ttymode; |
master_ttymode = initial_ttymode; |
|
|
|
|
#elif defined(TIOCSETN) |
#elif defined(TIOCSETN) |
|
|
fix_tty() |
void fix_tty() |
{ |
{ |
struct tchars tcbuf; |
struct tchars tcbuf; |
struct ltchars lcbuf; |
struct ltchars lcbuf; |
|
|
} |
} |
#endif |
#endif |
|
|
kill_process() |
void kill_process() |
{ |
{ |
|
|
if (child_pid) |
if (child_pid) |
(void) killpg (child_pid, SIGTERM); |
(void) killpg (child_pid, SIGTERM); |
} |
} |
|
|
void |
void terminate(int n) |
terminate(n) |
|
int n; |
|
{ |
{ |
extern int errno; |
extern int errno; |
|
|
|
|
exit (0); |
exit (0); |
} |
} |
|
|
send_int_sig() { |
int send_int_sig() { |
#ifndef __CYGWIN__ |
#ifndef __CYGWIN__ |
kill(child_pid,SIGINT); |
kill(child_pid,SIGINT); |
#endif |
#endif |
return 0; |
return 0; |
} |
} |
|
|
get_pty_master() |
void get_pty_master() |
{ |
{ |
char c; |
char c; |
struct stat stb; |
struct stat stb; |
Line 971 get_pty_master() |
|
Line 967 get_pty_master() |
|
return; |
return; |
} |
} |
|
|
get_pty_slave() |
void get_pty_slave() |
{ |
{ |
|
|
slave = open (slave_tty, 2); |
slave = open (slave_tty, 2); |
Line 1009 get_pty_slave() |
|
Line 1005 get_pty_slave() |
|
#endif |
#endif |
} |
} |
|
|
recover_tty() |
void recover_tty() |
{ |
{ |
#ifdef TERMIOS |
#ifdef TERMIOS |
tcsetattr(0, TCSANOW, &initial_ttymode); |
tcsetattr(0, TCSANOW, &initial_ttymode); |
|
|
#endif |
#endif |
} |
} |
|
|
suspend() |
int suspend() |
{ |
{ |
long pid; |
long pid; |
#if defined(sun) |
#if defined(sun) |
|
|
fep_repaint(0); |
fep_repaint(0); |
} |
} |
|
|
look_cmdinfo (command) |
void look_cmdinfo (char *command) |
char *command; |
|
{ |
{ |
struct cmdinfo *p; |
struct cmdinfo *p; |
char *allocAndCopyThere(); |
char *allocAndCopyThere(); |
Line 1080 look_cmdinfo (command) |
|
Line 1075 look_cmdinfo (command) |
|
} |
} |
|
|
|
|
usageAndExit() |
void usageAndExit() |
{ |
{ |
|
|
printf ("Usage: %s [-emacs|-vi] command\n", myself); |
printf ("Usage: %s [-emacs|-vi] command\n", myself); |