Date: Mon, 04 Jan 2010 16:50:26 +0000 From: Pete French <petefrench@ticketswitch.com> To: freebsd-stable@freebsd.org Subject: TIOCSTI possibly broken under 8.0 ? Message-ID: <E1NRq8Q-0000aC-Sa@dilbert.ticketswitch.com>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1NRq8Q-0000aC-Sa>