This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: text file formats


> Date: Thu, 6 Apr 2006 09:15:14 -0400
> From: Bob Rossi <bob_rossi@cox.net>
> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]