Thanks for responding. My responses are in-lined: When the terminal is in packet mode, skipping the first byte is the right > thing. The reporter apparently got bitten by this code without having the > terminal in packet mode. > How do I know/set the terminal in packet mode? How can we conclude that reporter didn't have terminal in packet mode? (I am just trying to learn/understand here).
> > > If someone could help me understand what this piece of code is doing, > that > > will be great. > > What is TIOCPKT? > > man 4 tty_ioctl has this: > Psuedoterminal ioctls > TIOCPKT const int *argp > Enable (when *argp is nonzero) or disable packet mode. Can be > applied to the master side of a pseudoterminal only (and will return > ENOTTY otherwise). In packet mode, each subsequent read(2) > will > return a packet that either contains a single nonzero control byte, > or has > a single byte containing zero (' ') followed by data written on > the slave side of the pseudoterminal. > I need to do more read-up on this thing :) > > > I did "git blame window.c" and found this portion of code written by > > jnweiger. > > Hiren, could you reproduce the bug? If so, Id like to know why the terminal > and screen disagree about package mode. > Yes, I could reproduce the bug exactly as reporter mentioned. I do not understand the second part of the question. Why do you think terminal and screen disagree? Is that the reason for the bug? Thanks, Hiren