From owner-freebsd-stable@FreeBSD.ORG Mon Jan 4 16:50:28 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 820E31065676 for ; Mon, 4 Jan 2010 16:50:28 +0000 (UTC) (envelope-from petefrench@ticketswitch.com) Received: from constantine.ticketswitch.com (constantine.ticketswitch.com [IPv6:2002:57e0:1d4e:1::3]) by mx1.freebsd.org (Postfix) with ESMTP id 4745D8FC17 for ; Mon, 4 Jan 2010 16:50:28 +0000 (UTC) Received: from dilbert.rattatosk ([10.64.50.6] helo=dilbert.ticketswitch.com) by constantine.ticketswitch.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69 (FreeBSD)) (envelope-from ) id 1NRq8Q-000Epp-TR for freebsd-stable@freebsd.org; Mon, 04 Jan 2010 16:50:26 +0000 Received: from petefrench by dilbert.ticketswitch.com with local (Exim 4.71 (FreeBSD)) (envelope-from ) id 1NRq8Q-0000aC-Sa for freebsd-stable@freebsd.org; Mon, 04 Jan 2010 16:50:26 +0000 Date: Mon, 04 Jan 2010 16:50:26 +0000 Message-Id: To: freebsd-stable@freebsd.org From: Pete French Subject: TIOCSTI possibly broken under 8.0 ? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2010 16:50:28 -0000 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 #include 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; }