From owner-freebsd-questions@FreeBSD.ORG Sat Feb 18 18:08:30 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C274E16A420 for ; Sat, 18 Feb 2006 18:08:30 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.44]) by mx1.FreeBSD.org (Postfix) with ESMTP id A7A9443D49 for ; Sat, 18 Feb 2006 18:08:25 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from mac.com (smtpin02-en2 [10.13.10.147]) by smtpout.mac.com (Xserve/8.12.11/smtpout12/MantshX 4.0) with ESMTP id k1II8P7m023168; Sat, 18 Feb 2006 10:08:25 -0800 (PST) Received: from [192.168.1.3] (pool-68-160-251-207.ny325.east.verizon.net [68.160.251.207]) (authenticated bits=0) by mac.com (Xserve/smtpin02/MantshX 4.0) with ESMTP id k1II8Mq4007858 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 18 Feb 2006 10:08:24 -0800 (PST) Message-ID: <43F76296.4010407@mac.com> Date: Sat, 18 Feb 2006 13:08:22 -0500 From: Chuck Swiger Organization: The Courts of Chaos User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: freebsd@voidmain.net References: <43F68C7D.9010403@voidmain.net> <1140233843.982.21.camel@chaucer.jeays.ca> <43F74361.90109@voidmain.net> <43F75DF6.3050903@mac.com> <43F75F3C.7080903@voidmain.net> In-Reply-To: <43F75F3C.7080903@voidmain.net> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: getline function 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: Sat, 18 Feb 2006 18:08:30 -0000 Tom Grove wrote: > Chuck Swiger wrote: [ ... ] >> getline() is not part of the standard C library. >> What makes you think gcc is broken...? > > Yeah...I see that after some more research. So, now I guess my question > is being that it's not standard and gets() is not safe to use what > should I use to grab lines? My gut tells me to copy the getline() > function from the K&R book but I'm not totally sure that's a great idea > either. Stupid strings always causing problems! Depending on what you'd like to do, GNU readline may be a fine solution to your situation. Otherwise, getch(stdin) with a bit of code to "cook" DEL/BS/CR/NL, or just use the getline port as you've already done. :-) -- -Chuck