This is the mail archive of the 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: Detecting text type in a shell script


At 08:13 2003-02-06, Nicolas Christin wrote:
On Thu, 6 Feb 2003, Max Bowsher wrote:

> Nicolas Christin wrote:
> >
> > How can I detect what text type was chosen at install time? (So that I
> > can appropriately set/unset my cygwin-unix-type variable.)
> man mount

Max, thanks.

OK... I had actually checked that, but it didn't come to me as
straightforward how to use it for my particular problem. Can I just
assume that if I don't see any "textmode" field in the mount table, then
everything is fine?
That would be a conservative approach. Clearly if there are no text mode mounts, text mode will not be in effect.

But note that you must also check the CYGWIN environment variable, though, for the "binmod" / "nobinmode" option. Refer to <> for details.

If you want to be more refined about the determination you make in your script, you'll have to analyze the mount table as reported by the "mount" command and emulate Cygwin's algorithm for determining which mount point is used to access a given file (name).

More specifically, does something of the kind:

# test we're in binmode

mount | grep textmode >/dev/null 2>&1

if [ "$?" -eq "0" ]; then
        # found text modes - probably bad

would do? (I don't have a DOS-type installed Cygwin available at the
moment, so I'm doing this blind and can't test it...)

Thanks again,

Randall Schulz

Unsubscribe info:
Bug reporting:

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