TIOCSTI appears to be broken - the code attached at the bottom works fine in 7.x but fails in 8.0. What the code is attempting to do is to print a prompt for text input, along with an initial value for that text which can be edited by the user. I am assuming this is a bug, and not incorrect usage of TIOCSTI, but evven if not it is still a regression compared to 7.x. The reason I am intested in this is that this is the code which is used by /usr/bin/mail to allow the headers to be edited in an email, so this does break a very basic piece of the base system. cheers, -pete. #include <stdio.h> #include <sys/ttycom.h> char *src = "hello world"; int main(int argc, char *argv[]) { char ch; int c; char *cp; char x[512]; puts("Enter text: "); fflush(stdout); cp = src == NULL ? "" : src; while ((c = *cp++) != '\0') { ch = c; ioctl(0, TIOCSTI, &ch); } fgets(x, 511, stdin); printf("We got: %s\n", x); fflush(stdout); return 0; }
On Mon, Jan 04, 2010 at 04:50:26PM +0000, Pete French wrote:> TIOCSTI appears to be broken - the code attached at the bottom > works fine in 7.x but fails in 8.0. What the code is attempting to > do is to print a prompt for text input, along with an initial > value for that text which can be edited by the user. I am assuming > this is a bug, and not incorrect usage of TIOCSTI, but evven if not > it is still a regression compared to 7.x. > > The reason I am intested in this is that this is the code which > is used by /usr/bin/mail to allow the headers to be edited in an > email, so this does break a very basic piece of the base system. > > cheers, > > -pete. > > > > > > #include <stdio.h> > #include <sys/ttycom.h> > > char *src = "hello world"; > > int > main(int argc, char *argv[]) > { > char ch; > int c; > char *cp; > char x[512]; > > puts("Enter text: "); > fflush(stdout); > > cp = src == NULL ? "" : src; > while ((c = *cp++) != '\0') { > ch = c; > ioctl(0, TIOCSTI, &ch); > } > > fgets(x, 511, stdin); > printf("We got: %s\n", x); > fflush(stdout); > return 0; > }Adding Ed Schouten to the thread, who will probably be able to shed some light on things. :-) -- | Jeremy Chadwick jdc@parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |
* Jeremy Chadwick <freebsd@jdc.parodius.com> wrote:> Adding Ed Schouten to the thread, who will probably be able to shed > some light on things. :-)http://80386.nl/pub/tty.diff Wrote it some time ago, but nobody wanted to test it for me, which made me asume nobody cared. ;-) -- Ed Schouten <ed@80386.nl> WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20100104/f431b970/attachment.pgp
> http://80386.nl/pub/tty.diff > > Wrote it some time ago, but nobody wanted to test it for me, which made > me asume nobody cared. ;-)Ah, well I care a lot and am testing it now, thankyou :-) Will report back later this evening... -pete.
> http://80386.nl/pub/tty.diffJust tested the patch - works beautifully! Please commit and MFC if you can :-) cheers, -pete.
* Pete French <petefrench@ticketswitch.com> wrote:> > http://80386.nl/pub/tty.diff > > Just tested the patch - works beautifully! Please commit and MFC if > you can :-)Done. Will MFC it in two weeks from now. Greetings, -- Ed Schouten <ed@80386.nl> WWW: http://80386.nl/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20100104/1201445e/attachment.pgp