
Here's another quick hack for you...

I recently converted to Linux/DJGPP a software project originally started
in Borland C under MS-DOG; but the project is continuously going on and,
worse, the other people working on it don't want to switch to Linux :-(
So I have to keep the source tree under DOS.

I was tired of continuously running fromdos/todos any time I had to compile
a new version, and at the same time I wanted to keep only one source tree.

So I asked myself, since the sources for this project are the same under
DOS and Linux, why gcc can't directly use the DOS sources?
It turns out that it can, with some limits.

The CR (\r) character is ignored by gcc; but it becomes significant
when the EOL is escaped: the sequence backslash\r\n is not recognized
as a valid continuation for a line, and gives an error.

I could of course filter and preprocess the source and then feed gcc with
the .i file, but I decided to take a look at the cpp sources. The result
is this small patch to cccp.c which makes the C preprocessor accept any
kind of EOL sequence.
Briefly, it converts \r\n to \n<space>, and \r alone to \n. \n\r (is this
used?) is converted to \n\n.

To activate this feature add
	-imsdos
to your CFLAGS (feel free to use a better name :-)

The patch is against gcc-2.7.0.
I included also a binary version of the modified cpp. This is in ELF
format; I was not able to produce an a.out binary (usual troubles with
beta software...). So if you want the a.out version:
	get the gcc-2.7.0 sources and unpack them
	enter the gcc directory and apply the patch (or replace
	 cccp.c with the one provided here)
	follow the instructions to configure gcc
	make cpp		/* this is enough, don't make all! */

I don't think many people use shared DOS/Linux sources, but who knows.
Please tell me (and gcc developers, of course) if you find this patch
useful.

Alberto			<a.vignani@crf.it>

