* Re: CR/NL problem with cpp.exe
[not found] <CHEDKHJJDLOCCOFLMGEAOEAACNAA.dvasaru@broadpark.no>
@ 2002-10-01 13:28 ` Kris Warkentin
2002-10-01 14:02 ` Dan Vasaru
2002-10-01 19:26 ` Larry Hall (RFK Partners, Inc)
0 siblings, 2 replies; 9+ messages in thread
From: Kris Warkentin @ 2002-10-01 13:28 UTC (permalink / raw)
To: Dan Vasaru, cygwin
I'm actually quite certain that what you wrote would help. The issue is
that cccp.c (the gcc preprocessor) does not do that and, as near as I can
tell from the FAQ, shouldn't need to. That, however, is where I might be
wrong. I'm wondering if the cpp shipped with Cygwin has been patched so
that it does explicitly open files as text. If that's the case, then that
might explain why I'm seeing different behaviour.
Aha! I just copied dosfile.c to a text mode partition and it works with our
preprocessor. That implies that there must be some buggery in the Cygwin
version of cpp.exe. I noticed that the version of gcc shipped with cygwin
is 2.95.3-5. Is the '-5' some form of Cygwin specific patch with some
assorted magic in it? Perhaps someone on this list would know.
cheers,
Kris
----- Original Message -----
From: "Dan Vasaru" <dvasaru@broadpark.no>
To: "Kris Warkentin" <kewarken@qnx.com>
Sent: Tuesday, October 01, 2002 4:18 PM
Subject: RE: CR/NL problem with cpp.exe
> Sorry about that, I set out to write a longer reply (which I posted to the
> group) and typed CTRL+ENTER just as I got started.
>
> If what I wrote to the group doesn't help, (opening your files with
O_TEXT,
> and setting stdin to textmode), then I believe you have a problem.
> 1. What type are your mounts (where your c files reside)
> 2. What is the value of the CYGWIN variable ?
>
> Dan
> -----Original Message-----
> From: Kris Warkentin [mailto:kewarken@qnx.com]
> Sent: Tuesday, October 01, 2002 10:04 PM
> To: Dan Vasaru
> Subject: Re: CR/NL problem with cpp.exe
>
>
> ----- Original Message -----
> From: "Dan Vasaru" <dvasaru@broadpark.no>
> To: "Kris Warkentin" <kewarken@qnx.com>
> Sent: Tuesday, October 01, 2002 3:48 PM
> Subject: RE: CR/NL problem with cpp.exe
>
>
> > Kris,
> >
> > Please refer to this section of the FAQ:
> >
>
> Which section? I've read the CR/NL sections of the FAQ and I believe I
> understand the issue at hand.
>
> 1) Two versions of cpp.exe, both compiled under cygwin, both running under
> same environment with the same input from the same filesystem.
> 2) The code for cpp.exe doesn't do anything special but rather just checks
> for '\\' '\n' at the end of a line.
> 3) The cpp.exe shipped with Cygwin works fine - input translation takes
> place just as the FAQ states - the open() call opens them in O_TEXT mode.
> 4) The cpp.exe that we built does not get the benefit of this input
> translation.
>
> As near as I can tell, our cpp.exe should 'just work' and yet it doesn't.
> Any suggestions?
>
> cheers,
>
> Kris
>
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: CR/NL problem with cpp.exe
2002-10-01 13:28 ` CR/NL problem with cpp.exe Kris Warkentin
@ 2002-10-01 14:02 ` Dan Vasaru
2002-10-02 4:53 ` Kris Warkentin
2002-10-01 19:26 ` Larry Hall (RFK Partners, Inc)
1 sibling, 1 reply; 9+ messages in thread
From: Dan Vasaru @ 2002-10-01 14:02 UTC (permalink / raw)
To: Kris Warkentin, cygwin
Kris,
I am no authority on the matter, but I believe most Cygwin/Win32 ports of
"text-based" utilities deal with CRLF/LF by setting the O_TEXT flag and
letting the (C) runtime translate the line endings for them.
Instead of adjusting the file input mode, please note that you may want to
adjust your preprocessor lexer to accept both styles of line endings.
What happens the day you will want to port your CPP to a true Unix, and will
get a DOS file as an input ? Unix will blissfully ignore the O_TEXT flag in
open() calls, and you'll have CR on your input pipe.
GREP is an example of a utility that *doesn't* use O_TEXT, and still handles
all styles of line terminations gracefully. At least in principle.
Dan.
-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
Of Kris Warkentin
Sent: Tuesday, October 01, 2002 10:26 PM
To: Dan Vasaru; cygwin@cygwin.com
Subject: Re: CR/NL problem with cpp.exe
I'm actually quite certain that what you wrote would help. The issue is
that cccp.c (the gcc preprocessor) does not do that and, as near as I can
tell from the FAQ, shouldn't need to. That, however, is where I might be
wrong. I'm wondering if the cpp shipped with Cygwin has been patched so
that it does explicitly open files as text. If that's the case, then that
might explain why I'm seeing different behaviour.
Aha! I just copied dosfile.c to a text mode partition and it works with our
preprocessor. That implies that there must be some buggery in the Cygwin
version of cpp.exe. I noticed that the version of gcc shipped with cygwin
is 2.95.3-5. Is the '-5' some form of Cygwin specific patch with some
assorted magic in it? Perhaps someone on this list would know.
cheers,
Kris
----- Original Message -----
From: "Dan Vasaru" <dvasaru@broadpark.no>
To: "Kris Warkentin" <kewarken@qnx.com>
Sent: Tuesday, October 01, 2002 4:18 PM
Subject: RE: CR/NL problem with cpp.exe
> Sorry about that, I set out to write a longer reply (which I posted to the
> group) and typed CTRL+ENTER just as I got started.
>
> If what I wrote to the group doesn't help, (opening your files with
O_TEXT,
> and setting stdin to textmode), then I believe you have a problem.
> 1. What type are your mounts (where your c files reside)
> 2. What is the value of the CYGWIN variable ?
>
> Dan
> -----Original Message-----
> From: Kris Warkentin [mailto:kewarken@qnx.com]
> Sent: Tuesday, October 01, 2002 10:04 PM
> To: Dan Vasaru
> Subject: Re: CR/NL problem with cpp.exe
>
>
> ----- Original Message -----
> From: "Dan Vasaru" <dvasaru@broadpark.no>
> To: "Kris Warkentin" <kewarken@qnx.com>
> Sent: Tuesday, October 01, 2002 3:48 PM
> Subject: RE: CR/NL problem with cpp.exe
>
>
> > Kris,
> >
> > Please refer to this section of the FAQ:
> >
>
> Which section? I've read the CR/NL sections of the FAQ and I believe I
> understand the issue at hand.
>
> 1) Two versions of cpp.exe, both compiled under cygwin, both running under
> same environment with the same input from the same filesystem.
> 2) The code for cpp.exe doesn't do anything special but rather just checks
> for '\\' '\n' at the end of a line.
> 3) The cpp.exe shipped with Cygwin works fine - input translation takes
> place just as the FAQ states - the open() call opens them in O_TEXT mode.
> 4) The cpp.exe that we built does not get the benefit of this input
> translation.
>
> As near as I can tell, our cpp.exe should 'just work' and yet it doesn't.
> Any suggestions?
>
> cheers,
>
> Kris
>
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: CR/NL problem with cpp.exe
2002-10-01 13:28 ` CR/NL problem with cpp.exe Kris Warkentin
2002-10-01 14:02 ` Dan Vasaru
@ 2002-10-01 19:26 ` Larry Hall (RFK Partners, Inc)
2002-10-02 4:58 ` Kris Warkentin
1 sibling, 1 reply; 9+ messages in thread
From: Larry Hall (RFK Partners, Inc) @ 2002-10-01 19:26 UTC (permalink / raw)
To: Kris Warkentin, Dan Vasaru, cygwin
Maybe Cygwin's version was linked with textmode.o or automode.o and yours
isn't.
Larry Hall lhall@rfk.com
RFK Partners, Inc. http://www.rfk.com
838 Washington Street (508) 893-9779 - RFK Office
Holliston, MA 01746 (508) 893-9889 - FAX
At 04:26 PM 10/1/2002, Kris Warkentin wrote:
>I'm actually quite certain that what you wrote would help. The issue is
>that cccp.c (the gcc preprocessor) does not do that and, as near as I can
>tell from the FAQ, shouldn't need to. That, however, is where I might be
>wrong. I'm wondering if the cpp shipped with Cygwin has been patched so
>that it does explicitly open files as text. If that's the case, then that
>might explain why I'm seeing different behaviour.
>
>Aha! I just copied dosfile.c to a text mode partition and it works with our
>preprocessor. That implies that there must be some buggery in the Cygwin
>version of cpp.exe. I noticed that the version of gcc shipped with cygwin
>is 2.95.3-5. Is the '-5' some form of Cygwin specific patch with some
>assorted magic in it? Perhaps someone on this list would know.
>
>cheers,
>
>Kris
>
>----- Original Message -----
>From: "Dan Vasaru" <dvasaru@broadpark.no>
>To: "Kris Warkentin" <kewarken@qnx.com>
>Sent: Tuesday, October 01, 2002 4:18 PM
>Subject: RE: CR/NL problem with cpp.exe
>
>
> > Sorry about that, I set out to write a longer reply (which I posted to the
> > group) and typed CTRL+ENTER just as I got started.
> >
> > If what I wrote to the group doesn't help, (opening your files with
>O_TEXT,
> > and setting stdin to textmode), then I believe you have a problem.
> > 1. What type are your mounts (where your c files reside)
> > 2. What is the value of the CYGWIN variable ?
> >
> > Dan
> > -----Original Message-----
> > From: Kris Warkentin [mailto:kewarken@qnx.com]
> > Sent: Tuesday, October 01, 2002 10:04 PM
> > To: Dan Vasaru
> > Subject: Re: CR/NL problem with cpp.exe
> >
> >
> > ----- Original Message -----
> > From: "Dan Vasaru" <dvasaru@broadpark.no>
> > To: "Kris Warkentin" <kewarken@qnx.com>
> > Sent: Tuesday, October 01, 2002 3:48 PM
> > Subject: RE: CR/NL problem with cpp.exe
> >
> >
> > > Kris,
> > >
> > > Please refer to this section of the FAQ:
> > >
> >
> > Which section? I've read the CR/NL sections of the FAQ and I believe I
> > understand the issue at hand.
> >
> > 1) Two versions of cpp.exe, both compiled under cygwin, both running under
> > same environment with the same input from the same filesystem.
> > 2) The code for cpp.exe doesn't do anything special but rather just checks
> > for '\\' '\n' at the end of a line.
> > 3) The cpp.exe shipped with Cygwin works fine - input translation takes
> > place just as the FAQ states - the open() call opens them in O_TEXT mode.
> > 4) The cpp.exe that we built does not get the benefit of this input
> > translation.
> >
> > As near as I can tell, our cpp.exe should 'just work' and yet it doesn't.
> > Any suggestions?
> >
> > cheers,
> >
> > Kris
> >
> >
>
>
>--
>Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
>Bug reporting: http://cygwin.com/bugs.html
>Documentation: http://cygwin.com/docs.html
>FAQ: http://cygwin.com/faq/
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: CR/NL problem with cpp.exe
2002-10-01 14:02 ` Dan Vasaru
@ 2002-10-02 4:53 ` Kris Warkentin
2002-10-02 7:08 ` Christopher Faylor
0 siblings, 1 reply; 9+ messages in thread
From: Kris Warkentin @ 2002-10-02 4:53 UTC (permalink / raw)
To: Dan Vasaru, cygwin
I agree. It's just that the util I'm looking at is GNU cpp, which DOES have
a cygwin specific port but doesn't seem to deal with the CRLF problem. So
we've got the situation that, for whatever reason, it doesn't look like all
the Cygwin changes were rolled into the public branch which is the puzzle.
I'm wondering if there is some reason why but I'm agreeing with you and I
think I might just hack the preprocessor to properly deal with the '\r'.
Probably the most portable way.
cheers,
Kris
----- Original Message -----
From: "Dan Vasaru" <dvasaru@broadpark.no>
To: "Kris Warkentin" <kewarken@qnx.com>; <cygwin@cygwin.com>
Sent: Tuesday, October 01, 2002 5:02 PM
Subject: RE: CR/NL problem with cpp.exe
> Kris,
>
> I am no authority on the matter, but I believe most Cygwin/Win32 ports of
> "text-based" utilities deal with CRLF/LF by setting the O_TEXT flag and
> letting the (C) runtime translate the line endings for them.
>
> Instead of adjusting the file input mode, please note that you may want to
> adjust your preprocessor lexer to accept both styles of line endings.
> What happens the day you will want to port your CPP to a true Unix, and
will
> get a DOS file as an input ? Unix will blissfully ignore the O_TEXT flag
in
> open() calls, and you'll have CR on your input pipe.
>
> GREP is an example of a utility that *doesn't* use O_TEXT, and still
handles
> all styles of line terminations gracefully. At least in principle.
>
> Dan.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: CR/NL problem with cpp.exe
2002-10-01 19:26 ` Larry Hall (RFK Partners, Inc)
@ 2002-10-02 4:58 ` Kris Warkentin
0 siblings, 0 replies; 9+ messages in thread
From: Kris Warkentin @ 2002-10-02 4:58 UTC (permalink / raw)
To: Dan Vasaru, cygwin, Larry Hall (RFK Partners, Inc)
----- Original Message -----
From: "Larry Hall (RFK Partners, Inc)" <lhall@rfk.com>
To: "Kris Warkentin" <kewarken@qnx.com>; "Dan Vasaru"
<dvasaru@broadpark.no>; <cygwin@cygwin.com>
Sent: Tuesday, October 01, 2002 10:21 PM
Subject: Re: CR/NL problem with cpp.exe
> Maybe Cygwin's version was linked with textmode.o or automode.o and yours
> isn't.
Okay...this is something new. Do these objects do some Cygwin 'magic' to
make things work? Where would I find them?
Kris
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: CR/NL problem with cpp.exe
2002-10-02 4:53 ` Kris Warkentin
@ 2002-10-02 7:08 ` Christopher Faylor
0 siblings, 0 replies; 9+ messages in thread
From: Christopher Faylor @ 2002-10-02 7:08 UTC (permalink / raw)
To: cygwin
On Wed, Oct 02, 2002 at 08:07:03AM -0400, Kris Warkentin wrote:
>I agree. It's just that the util I'm looking at is GNU cpp, which DOES have
>a cygwin specific port but doesn't seem to deal with the CRLF problem. So
>we've got the situation that, for whatever reason, it doesn't look like all
>the Cygwin changes were rolled into the public branch which is the puzzle.
This is correct. All of the cygwin changes were not rolled back into 2.95.
Some of them were submitted and never approved. Some were not approved.
As soon as we officially release gcc 3.2, I plan on trying to get the gcc
changes applied to the gcc mainline. It will be a long road ahead, though.
In the meantime, the sources that were used to build gcc are available
for download.
cgf
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: CR/NL problem with cpp.exe
2002-10-01 11:49 ` Kris Warkentin
@ 2002-10-01 12:58 ` Dan Vasaru
0 siblings, 0 replies; 9+ messages in thread
From: Dan Vasaru @ 2002-10-01 12:58 UTC (permalink / raw)
To: cygwin
Nick, please refer to:
"How is the DOS/Unix CR/LF thing handled?" in the cygwin faq:
http://cygwin.com/faq/faq_4.html#SEC72
Also, read the documentation for the "mount" utility and the CYGWIN
environment variable setting.
If you want to make sure that the input to your "cpp" is translated no
matter the file access mode (which depends on the mount mode for files and
CYGWIN variable for pipes), I believe you need to make sure that the input
is set to text mode:
- when opening a file, add the text mode to the open calls:
o fopen(..., "rt")
o open(..., O_..... | O_TEXT)
- when reading text from stdin:
o setmode (0, O_TEXT) // 0 is the file descriptor for stdin
.
Dan
-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
Of Kris Warkentin
Sent: Tuesday, October 01, 2002 8:47 PM
To: cygwin@cygwin.com
Subject: Re: CR/NL problem with cpp.exe
> printf("This is a long string across\
> multiple lines");
>
> or a backslashified #define is being concatenated. Now, if I use the
Cygwin
> cpp.exe, I get the following (expected) behaviour:
Correction: I meant NOT being concatenated.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: CR/NL problem with cpp.exe
2002-10-01 11:15 Kris Warkentin
@ 2002-10-01 11:49 ` Kris Warkentin
2002-10-01 12:58 ` Dan Vasaru
0 siblings, 1 reply; 9+ messages in thread
From: Kris Warkentin @ 2002-10-01 11:49 UTC (permalink / raw)
To: cygwin
> printf("This is a long string across\
> multiple lines");
>
> or a backslashified #define is being concatenated. Now, if I use the
Cygwin
> cpp.exe, I get the following (expected) behaviour:
Correction: I meant NOT being concatenated.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 9+ messages in thread
* CR/NL problem with cpp.exe
@ 2002-10-01 11:15 Kris Warkentin
2002-10-01 11:49 ` Kris Warkentin
0 siblings, 1 reply; 9+ messages in thread
From: Kris Warkentin @ 2002-10-01 11:15 UTC (permalink / raw)
To: cygwin
Hello,
Our Windows hosted development tools are compiled under Cygwin and I'm
observing a strange problem with Dos style text files not being
pre-processed correctly. Specifically, something like this:
printf("This is a long string across\
multiple lines");
or a backslashified #define is being concatenated. Now, if I use the Cygwin
cpp.exe, I get the following (expected) behaviour:
cpp.exe dosfile.c # works fine - cygwin.dll does input translation
cpp.exe < dosfile.c # doesn't work since shell isn't doing input translation
However with our cpp, it doesn't work in either case. I've looked at the
code for cpp and it doesn't do anything special, just ordinary opens and
fopens. From what I understand of the way cygwin.dll works, this should be
fine and they should be opened as text files but in our case, it doesn't
seem to happen.
What am I missing? Is there some sort of define or configure option that I
should be using to make this work properly? It can't be $CYGWIN since the
cygwin cpp.exe works fine in the same environment as ours so I'm at a
complete loss.
cheers,
Kris
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2002-10-02 14:08 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CHEDKHJJDLOCCOFLMGEAOEAACNAA.dvasaru@broadpark.no>
2002-10-01 13:28 ` CR/NL problem with cpp.exe Kris Warkentin
2002-10-01 14:02 ` Dan Vasaru
2002-10-02 4:53 ` Kris Warkentin
2002-10-02 7:08 ` Christopher Faylor
2002-10-01 19:26 ` Larry Hall (RFK Partners, Inc)
2002-10-02 4:58 ` Kris Warkentin
2002-10-01 11:15 Kris Warkentin
2002-10-01 11:49 ` Kris Warkentin
2002-10-01 12:58 ` Dan Vasaru
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).