version 1.1, 1995/10/18 08:46:16 |
version 1.2, 1995/12/14 03:12:14 |
|
|
/* $NetBSD: cmds.c,v 1.5 1995/09/26 06:02:08 jtc Exp $ */ |
/* $NetBSD: cmds.c,v 1.6 1995/10/29 00:49:38 pk Exp $ */ |
|
|
/* |
/* |
* Copyright (c) 1983, 1993 |
* Copyright (c) 1983, 1993 |
|
|
#if 0 |
#if 0 |
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93"; |
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93"; |
#endif |
#endif |
static char rcsid[] = "$NetBSD: cmds.c,v 1.5 1995/09/26 06:02:08 jtc Exp $"; |
static char rcsid[] = "$NetBSD: cmds.c,v 1.6 1995/10/29 00:49:38 pk Exp $"; |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#include "tip.h" |
#include "tip.h" |
|
|
pwrite(FD, &r, 1); |
pwrite(FD, &r, 1); |
do |
do |
read(FD, &c, 1); |
read(FD, &c, 1); |
while ((c&0177) != '\n'); |
while ((c&STRIP_PAR) != '\n'); |
ioctl(0, TIOCSETC, &defchars); |
tcsetattr(0, TCSAFLUSH, &defchars); |
|
|
(void) setjmp(intbuf); |
(void) setjmp(intbuf); |
f = signal(SIGINT, intcopy); |
f = signal(SIGINT, intcopy); |
start = time(0); |
start = time(0); |
for (ct = 0; !quit;) { |
for (ct = 0; !quit;) { |
eof = read(FD, &c, 1) <= 0; |
eof = read(FD, &c, 1) <= 0; |
c &= 0177; |
c &= STRIP_PAR; |
if (quit) |
if (quit) |
continue; |
continue; |
if (eof || any(c, eofchars)) |
if (eof || any(c, eofchars)) |
|
|
|
|
if (boolean(value(VERBOSE))) |
if (boolean(value(VERBOSE))) |
prtime(" lines transferred in ", time(0)-start); |
prtime(" lines transferred in ", time(0)-start); |
ioctl(0, TIOCSETC, &tchars); |
tcsetattr(0, TCSAFLUSH, &term); |
write(fildes[1], (char *)&ccc, 1); |
write(fildes[1], (char *)&ccc, 1); |
signal(SIGINT, f); |
signal(SIGINT, f); |
close(fd); |
close(fd); |
|
|
return; |
return; |
} |
} |
transmit(fd, value(EOFWRITE), NULL); |
transmit(fd, value(EOFWRITE), NULL); |
if (!boolean(value(ECHOCHECK))) { |
if (!boolean(value(ECHOCHECK))) |
struct sgttyb buf; |
tcdrain(FD); |
|
|
ioctl(FD, TIOCGETP, &buf); /* this does a */ |
|
ioctl(FD, TIOCSETP, &buf); /* wflushtty */ |
|
} |
|
} |
} |
|
|
/* |
/* |
|
|
kill(pid, SIGIOT); /* put TIPOUT into a wait state */ |
kill(pid, SIGIOT); /* put TIPOUT into a wait state */ |
stop = 0; |
stop = 0; |
f = signal(SIGINT, stopsnd); |
f = signal(SIGINT, stopsnd); |
ioctl(0, TIOCSETC, &defchars); |
tcsetattr(0, TCSAFLUSH, &defchars); |
read(repdes[0], (char *)&ccc, 1); |
read(repdes[0], (char *)&ccc, 1); |
if (command != NULL) { |
if (command != NULL) { |
for (pc = command; *pc; pc++) |
for (pc = command; *pc; pc++) |
|
|
if (boolean(value(ECHOCHECK))) |
if (boolean(value(ECHOCHECK))) |
read(FD, (char *)&c, 1); /* trailing \n */ |
read(FD, (char *)&c, 1); /* trailing \n */ |
else { |
else { |
struct sgttyb buf; |
tcdrain(FD); |
|
|
ioctl(FD, TIOCGETP, &buf); /* this does a */ |
|
ioctl(FD, TIOCSETP, &buf); /* wflushtty */ |
|
sleep(5); /* wait for remote stty to take effect */ |
sleep(5); /* wait for remote stty to take effect */ |
} |
} |
} |
} |
|
|
alarm(0); |
alarm(0); |
goto out; |
goto out; |
} |
} |
} while ((c&0177) != character(value(PROMPT))); |
} while ((c&STRIP_PAR) != character(value(PROMPT))); |
alarm(0); |
alarm(0); |
} |
} |
} |
} |
|
|
else |
else |
prtime(" lines transferred in ", stop_t-start_t); |
prtime(" lines transferred in ", stop_t-start_t); |
write(fildes[1], (char *)&ccc, 1); |
write(fildes[1], (char *)&ccc, 1); |
ioctl(0, TIOCSETC, &tchars); |
tcsetattr(0, TCSAFLUSH, &term); |
} |
} |
|
|
/* |
/* |
|
|
kill(pid, SIGIOT); /* put TIPOUT into a wait state */ |
kill(pid, SIGIOT); /* put TIPOUT into a wait state */ |
signal(SIGINT, SIG_IGN); |
signal(SIGINT, SIG_IGN); |
signal(SIGQUIT, SIG_IGN); |
signal(SIGQUIT, SIG_IGN); |
ioctl(0, TIOCSETC, &defchars); |
tcsetattr(0, TCSAFLUSH, &defchars); |
read(repdes[0], (char *)&ccc, 1); |
read(repdes[0], (char *)&ccc, 1); |
/* |
/* |
* Set up file descriptors in the child and |
* Set up file descriptors in the child and |
|
|
if (boolean(value(VERBOSE))) |
if (boolean(value(VERBOSE))) |
prtime("away for ", time(0)-start); |
prtime("away for ", time(0)-start); |
write(fildes[1], (char *)&ccc, 1); |
write(fildes[1], (char *)&ccc, 1); |
ioctl(0, TIOCSETC, &tchars); |
tcsetattr(0, TCSAFLUSH, &term); |
signal(SIGINT, SIG_DFL); |
signal(SIGINT, SIG_DFL); |
signal(SIGQUIT, SIG_DFL); |
signal(SIGQUIT, SIG_DFL); |
} |
} |
|
|
kill(pid, SIGIOT); /* put TIPOUT into a wait state */ |
kill(pid, SIGIOT); /* put TIPOUT into a wait state */ |
signal(SIGINT, SIG_IGN); |
signal(SIGINT, SIG_IGN); |
signal(SIGQUIT, SIG_IGN); |
signal(SIGQUIT, SIG_IGN); |
ioctl(0, TIOCSETC, &defchars); |
tcsetattr(0, TCSAFLUSH, &defchars); |
read(repdes[0], (char *)&ccc, 1); |
read(repdes[0], (char *)&ccc, 1); |
/* |
/* |
* Set up file descriptors in the child and |
* Set up file descriptors in the child and |
|
|
if (boolean(value(VERBOSE))) |
if (boolean(value(VERBOSE))) |
prtime("away for ", time(0)-start); |
prtime("away for ", time(0)-start); |
write(fildes[1], (char *)&ccc, 1); |
write(fildes[1], (char *)&ccc, 1); |
ioctl(0, TIOCSETC, &tchars); |
tcsetattr(0, TCSAFLUSH, &term); |
signal(SIGINT, SIG_DFL); |
signal(SIGINT, SIG_DFL); |
signal(SIGQUIT, SIG_DFL); |
signal(SIGQUIT, SIG_DFL); |
} |
} |
|
|
tandem(option) |
tandem(option) |
char *option; |
char *option; |
{ |
{ |
struct sgttyb rmtty; |
struct termios rmtty; |
|
|
ioctl(FD, TIOCGETP, &rmtty); |
tcgetattr(FD, &rmtty); |
if (strcmp(option,"on") == 0) { |
if (strcmp(option, "on") == 0) { |
rmtty.sg_flags |= TANDEM; |
rmtty.c_iflag |= IXOFF; |
arg.sg_flags |= TANDEM; |
term.c_iflag |= IXOFF; |
} else { |
} else { |
rmtty.sg_flags &= ~TANDEM; |
rmtty.c_iflag &= ~IXOFF; |
arg.sg_flags &= ~TANDEM; |
term.c_iflag &= ~IXOFF; |
} |
} |
ioctl(FD, TIOCSETP, &rmtty); |
tcsetattr(FD, TCSADRAIN, &rmtty); |
ioctl(0, TIOCSETP, &arg); |
tcsetattr(0, TCSADRAIN, &term); |
} |
} |
|
|
/* |
/* |