delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/10/17/09:16:47

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: starting a CYGWIN app from a Windows Service
Date: Thu, 17 Oct 2002 08:16:24 -0500
Message-ID: <9532AC3F9163F4458A2A212C4CF8A2EC2C950B@liilmtst03.mailtask.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Madsen, Mark" <Mark DOT Madsen AT divine DOT com>
To: <cygwin AT cygwin DOT com>
X-OriginalArrivalTime: 17 Oct 2002 13:16:26.0827 (UTC) FILETIME=[65F161B0:01C275DF]
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g9HDGka06952

Thanks Dan. Using "rt" fixed the problem for the moment.

I will still need to understand exactly why there was a difference though. CYGWIN is undefined in both circumstances. What I don't understand is the "system" vs. "user" mount types. The file is on the local file system, (C:/.../file.txt) so I don't know if that applies here.

-Mark


-----Original Message-----
From:	Dan Vasaru [mailto:dvasaru AT broadpark DOT no]
Sent:	Wed 10/16/2002 5:09 PM
To:	Madsen, Mark; cygwin AT cygwin DOT com
Cc:	
Subject:	RE: starting a CYGWIN app from a Windows Service
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.

Dan

PS. To explain the behaviour you're seeing you have to check 4 places:

value of the CYGWIN environment variable when running as a service
value of the CYGWIN environment variable when running as yourself
system mount types
user mount types

There's probably a difference in the mount mode or CYGWIN variable between
the 2 cases.

Dan

-----Original Message-----
From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com]On Behalf
Of Madsen, Mark
Sent: Wednesday, October 16, 2002 11:21 PM
To: cygwin AT cygwin DOT com
Subject: starting a CYGWIN app from a Windows Service


When I run an application that uses the cygwin1.dll from either a Windows
Service and then from the command line I get different results when trying
to read a text file.

As a Windows Service:
I use fopen and fgets to read a DOS text file and the CR/LF combinations are
handled properly. Meaning that I only see the single LF.

Running from a DOS command line:
Using the exact same executable image as above, both characters are in the
buffer.

What I know:
Both instances use the very same DLL image. (I deleted it and both instances
complain about the DLL missing.)

Both instances are reading the exact same file, not two different copies.

I tried working with the CYGWIN environment variable with no effect on the
outcome.

Any help would be greatly appreciated.
Thanks,
Mark

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019