From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15696 invoked by alias); 6 Apr 2006 18:53:49 -0000 Received: (qmail 15681 invoked by uid 22791); 6 Apr 2006 18:53:48 -0000 X-Spam-Check-By: sourceware.org Received: from romy.inter.net.il (HELO romy.inter.net.il) (192.114.186.66) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 06 Apr 2006 18:53:46 +0000 Received: from HOME-C4E4A596F7 (IGLD-80-230-90-229.inter.net.il [80.230.90.229]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id DXJ68992 (AUTH halo1); Thu, 6 Apr 2006 21:53:38 +0300 (IDT) Date: Thu, 06 Apr 2006 19:01:00 -0000 Message-Id: From: Eli Zaretskii To: gdb@sources.redhat.com In-reply-to: <20060406131514.GH11610@brasko.net> (message from Bob Rossi on Thu, 6 Apr 2006 09:15:14 -0400) Subject: Re: text file formats Reply-to: Eli Zaretskii References: <20060405223122.GB11610@brasko.net> <20060406131514.GH11610@brasko.net> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00076.txt.bz2 > Date: Thu, 6 Apr 2006 09:15:14 -0400 > From: Bob Rossi > Cc: gdb@sources.redhat.com > > > (a) For native end-of-line (EOL) format, use the native C library and > > specify the text-mode I/O when you open the file. > > > > (b) For non-native but consistent EOL format, read the file in binary > > mode, analyze its first chunk, and then manually convert the > > original EOL markers into literal \n. > > OK, that's fine, except, you don't know if the file is native/non-native > EOL until you open it and process the entire file. You do know that if all you want to handle is the native format. If you want to handle non-native formats as well, you must do (b). > > The only two methods I know of to handle the mixed case are: > > > > (1) Fall back to Unix-style EOL and show the ^M literally. > > OK. > > (2) Let the user specify the EOL and then apply the (b) strategy > > above. > > OK, that's fine, but is this what GDB, GCC do? No, that's what Emacs does. Daniel told you what GDB does. As for GCC, I simply don't know, but I think it does handle DOS-style CR-LF EOLs on non-Windows machines. Not sure about the (old) Mac style.