From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7043 invoked by alias); 5 Apr 2006 22:31:21 -0000 Received: (qmail 7030 invoked by uid 22791); 5 Apr 2006 22:31:21 -0000 X-Spam-Check-By: sourceware.org Received: from eastrmmtao03.cox.net (HELO eastrmmtao03.cox.net) (68.230.240.36) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 05 Apr 2006 22:31:19 +0000 Received: from localhost.localdomain ([68.9.66.48]) by eastrmmtao03.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20060405223114.PTIW29285.eastrmmtao03.cox.net@localhost.localdomain> for ; Wed, 5 Apr 2006 18:31:14 -0400 Received: from bob by localhost.localdomain with local (Exim 4.52) id 1FRGX4-0003ig-W4 for gdb@sources.redhat.com; Wed, 05 Apr 2006 18:31:22 -0400 Date: Wed, 05 Apr 2006 22:31:00 -0000 From: Bob Rossi To: gdb@sources.redhat.com Subject: text file formats Message-ID: <20060405223122.GB11610@brasko.net> Mail-Followup-To: gdb@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i 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/msg00040.txt.bz2 Hi, While trying to display to the user a source file, it has become increasingly obvious to me how complicated such a simple task can be. Unix formatted text files have "\n" for a newline, dos formatted text files have "\r\n" for a newline and mac formatted text files have "\r" for a newline. In the 3 case's above it is obvious how to determine exactly which line is which. However, it is easy to mix these file formats. In this case, any particular file can use any combination of "\r", "\r\n" and "\n" for newlines. I'm not even sure how to display such a file. I'm guessing that's it's ambiguous, and i can make a best guess as to what the newline sequence should be. Is this correct? One thing I have determined, is that in order to know what the file format is, the entire text file needs to be parsed. After that, either the file format is defined (unix/dos/mac) or it is undefined (mix of them). I would like to make sure that the algorithm CGDB uses to determine the line number from a file is the same algorithm that GDB uses. Can anyone point me in the correct direction? Thanks, Bob Rossi