This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: DOS compatibility problem
- To: Stane Gruden <staneg at rd dot iskraemeco dot si>
- Subject: Re: DOS compatibility problem
- From: "Zack Weinberg" <zackw at stanford dot edu>
- Date: Thu, 1 Feb 2001 23:19:49 -0800
- Cc: gcc at gcc dot gnu dot org
- References: <3A7A58CF.44A68A5D@rd.iskraemeco.si>
On Fri, Feb 02, 2001 at 07:50:55AM +0100, Stane Gruden wrote:
> Hi,
>
> I have a following problem: I tried to compile a file that was
> edited under Windows. I was compiling with gcc under Linux.
> The problem was with macros that
> expand into more lines using the character '\'. This character
> has to be the last in the line in order for preprocessor to
> work correctly. Since in DOS the lines are terminated with
> 0x0D 0x0A, and in Linux only with 0x0A, the preprocessor
> obviously treated 0x0D that was found in the file
> as extra character, '\' not being the
> last in line anymore and compilation reported an error.
>
> Is there any option in gcc to solve this problem or do I have
> to use some dos->unix converter? In case of converter needed,
> does any tool exist that would convert entire directory trees
> not only a single file like dos2unix?
The development version of GCC will accept both DOS and Unix style
line breaks automatically. You don't have to do anything.
Unfortunately, if you don't want to use a development snapshot, you
will have to wait for 3.0, or continue to use a converter.
If you want to convert an entire tree all at once, try this
(untested):
$ find . -name '*.[ch]' -print | xargs perl -pi.bak -e 's/\r$//'
zw