This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin 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: starting a cygwin app from a Windows Service


I think you're missing my point, Chris.

I am trying to convince software authors to make their Unix software
compatible with text files creates in the DOS world, at least until libc on
all Unixes of the world implement text translation (which they currently
don't).

This is not a CYGWIN issue, but rather a design decision:
"Should the Linux version of our software XXX be able to read and understand
config files modified in Notepad by our new sysadm which never heard of
dos2unix" ?

Unfortunately, the only solution to accepting both CRLF and LF text files on
ALL platform is to handle the translation yourself.

Dan

-----Original Message-----
From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
Of Christopher Faylor
Sent: Thursday, October 17, 2002 1:07 AM
To: cygwin@cygwin.com
Subject: Re: starting a cygwin app from a Windows Service


On Thu, Oct 17, 2002 at 12:09:35AM +0200, Dan Vasaru wrote:
>Mark,
>
>As Chris suggested, if you want consistent behaviour under cygwin, always
>open text files in text mode (O_TEXT or "rt").
>Even better, wrt portability to Unix platforms, is to:
>
>1. open the file in binary mode
>2. be prepared to accept both CRLF- and LF-style text files (i.e. strip the
>CR yourself)
>
>This way, your software will always "behave" when encountering a Windows
>file while running on a Unix platform.

I don't know.  I think it would be far simpler to have something like:

#ifdef __CYGWIN__
# define READTEXT "rt"
#else
# define READTEXT "r"
#endif

.
.
.

  FILE fp = fopen ("foo", READTEXT);

rather than reinvent the CRLF handling that already exists in the cygwin
DLL.

Another option is to link with /usr/lib/automode.o or /usr/lib/textmode.o .

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/


--
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/


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