4.2BSD Script drops characters
Chuck Privitera
crp at ccivax.UUCP
Thu Nov 15 00:23:23 AEST 1984
Description:
In article <3197 at ucbvax.ARPA> Jeff Anton points out:
> ....
> In cbreak mode interupt chars from the terminal will be
> caught and delivered to the script program which is
> not set up to handle them properly.
An oversight on my part, sorry for the inconvenience.
I just noticed this yesterday when I used script
to post some bug reports.
Repeat-by:
Apply the cbreak fix article <219 at ccivax.UUCP> then
run script. When the interupt or quit character is typed
script will exit leaving the terminal in cbreak mode
and -echo. (typing the suspend character will suspend
script, probably NOT what you wanted)
Fix:
Turn off all special characters except start/stop.
rcsdiff -c3 -r1.2 script.c
RCS file: RCS/script.c,v
retrieving revision 1.2
diff -c3 -r1.2 script.c
*** /tmp/,RCSt1002637 Wed Nov 14 09:10:11 1984
--- script.c Wed Nov 14 09:09:05 1984
***************
*** 151,156
fail();
}
fixtty()
{
struct sgttyb sbuf;
--- 151,159 -----
fail();
}
+ struct tchars ntc = { -1, -1, -1, -1, -1, -1 };
+ struct ltchars nlc = { -1, -1, -1, -1, -1, -1 };
+
fixtty()
{
struct sgttyb sbuf;
***************
*** 159,164
sbuf.sg_flags |= CBREAK;
sbuf.sg_flags &= ~ECHO;
ioctl(0, TIOCSETP, (char *)&sbuf);
}
fail()
--- 162,171 -----
sbuf.sg_flags |= CBREAK;
sbuf.sg_flags &= ~ECHO;
ioctl(0, TIOCSETP, (char *)&sbuf);
+ ntc.t_startc = tc.t_startc;
+ ntc.t_stopc = tc.t_stopc;
+ ioctl(0, TIOCSETC, (char *)&ntc);
+ ioctl(0, TIOCSLTC, (char *)&nlc);
}
fail()
***************
*** 172,177
{
ioctl(0, TIOCSETP, (char *)&b);
printf("Script done, file is %s\n", fname);
exit(0);
}
--- 179,186 -----
{
ioctl(0, TIOCSETP, (char *)&b);
+ ioctl(0, TIOCSETC, (char *)&tc);
+ ioctl(0, TIOCSLTC, (char *)&lc);
printf("Script done, file is %s\n", fname);
exit(0);
}
More information about the Comp.bugs.2bsd
mailing list