#include <termios.h>
#include <string.h>
#include <stdio.h>
#include "telnet.h"
#include "local.h"externint scrindex;
externstruct termios tntty;
/*ARGSUSED*/int
scrinit(FILE *sfp, FILE *tfp, int c)
{
struct termios newtty;
if (!doecho) {
fprintf(tfp, "\nscripting requires remote ECHO.\n");
return -1;
}
if (scrfp) {
fprintf(tfp,"\nalready scripting to \"%s\".\n", scrname);
return -1;
}
scrindex = 0;
if (tcgetattr(0, &tntty)) /* save current tty settings */
errexit("can't get tty modes: %s\n", strerror(errno));
newtty = oldtty;
newtty.c_cc[VINTR] = _POSIX_VDISABLE; /* disable interrupt */
newtty.c_cc[VQUIT] = _POSIX_VDISABLE; /* disable interrupt */
newtty.c_cc[VSUSP] = _POSIX_VDISABLE; /* disable suspend */
newtty.c_cc[VDSUSP] = _POSIX_VDISABLE; /* disable suspend */if (tcsetattr(0, TCSADRAIN, &newtty))
errexit("can't set tty modes: %s\n", strerror(errno));
fprintf(tfp, "\nscript file: ");
(void) fflush(tfp);
return 0;
}