This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: DOS compatibility problem


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

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