From owner-freebsd-questions@FreeBSD.ORG Thu Apr 16 19:03:47 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCD141065694 for ; Thu, 16 Apr 2009 19:03:47 +0000 (UTC) (envelope-from tobias.rehbein@web.de) Received: from fmmailgate03.web.de (fmmailgate03.web.de [217.72.192.234]) by mx1.freebsd.org (Postfix) with ESMTP id 8237E8FC22 for ; Thu, 16 Apr 2009 19:03:47 +0000 (UTC) (envelope-from tobias.rehbein@web.de) Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216]) by fmmailgate03.web.de (Postfix) with ESMTP id 0B251FA9119F; Thu, 16 Apr 2009 21:03:46 +0200 (CEST) Received: from [95.88.233.234] (helo=sushi.pseudo.local) by smtp08.web.de with smtp (WEB.DE 4.110 #277) id 1LuWsD-0002oB-00; Thu, 16 Apr 2009 21:03:45 +0200 Received: from sushi.pseudo.local (localhost [127.0.0.1]) by sushi.pseudo.local (8.14.3/8.14.3) with ESMTP id n3GJ3qnt007533; Thu, 16 Apr 2009 21:03:52 +0200 (CEST) (envelope-from tobi@sushi.pseudo.local) Received: (from tobi@localhost) by sushi.pseudo.local (8.14.3/8.14.3/Submit) id n3GJ3q6v007532; Thu, 16 Apr 2009 21:03:52 +0200 (CEST) (envelope-from tobi) Date: Thu, 16 Apr 2009 21:03:52 +0200 From: Tobias Rehbein To: Mel Flynn Message-ID: <20090416190352.GA5366@sushi.pseudo.local> Mail-Followup-To: Mel Flynn , freebsd-questions@freebsd.org References: <20090414181300.GA3813@sushi.pseudo.local> <200904142107.26678.mel.flynn+fbsd.questions@mailing.thruhere.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200904142107.26678.mel.flynn+fbsd.questions@mailing.thruhere.net> User-Agent: Mutt/1.4.2.3i Sender: tobias.rehbein@web.de X-Sender: tobias.rehbein@web.de X-Provags-ID: V01U2FsdGVkX18fQglB1b+hmIWkgE3V3zmi1OZzmHrkr5eKBEQK dOggcOCWircXIGPtRsSSQ58UDh7twhuwkk5DmJN0qBrzFRf4gZ 0ibH9MIq+4fUgbwP4Cdw== Cc: freebsd-questions@freebsd.org Subject: Re: [OT] C programming question: reopen stdin X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Apr 2009 19:03:49 -0000 Am Tue, Apr 14, 2009 at 09:07:26PM +0200 schrieb Mel Flynn: > On Tuesday 14 April 2009 20:13:00 Tobias Rehbein wrote: > > > I'm having a little trouble solving a specific problem in C. I want to > > write a filter which reads data from stdin. After reading the user should > > be able to interact with the program via stdin. > > Just open(2) /dev/tty. If tty is invalid, then you don't have to expect a user > either. Thanks for this hint. I tried to implement an example. Good someone take a look at it and tell me if I did it right. Well, at least it works... The code is here: http://gist.github.com/95320 To avoid further spamming of the freebsd-questions mailing list: Could someone point me to a good place to ask C programming questions? Regards Tobias