Subject: Re: Detecting text type in a shell script
From: "Max Bowsher" <[email-masked]>
To: "Nicolas Christin" <[email-masked]>
Cc: <[email-masked]>
Date: Thu, 6 Feb 2003 16:26:47 -0000

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?
>
> More specifically, does something of the kind:
>
> #!/bin/sh
> # test we're in binmode
>
> mount | grep textmode >/dev/null 2>&1
>
> if [ "$?" -eq "0" ]; then
>         # found text modes - probably bad
>         bail();
> else
>         proceed();
> fi;
>
> 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...)

Should do, but ditto.

Have you tried linking you app with -lbinmode ? That should force all file
access to be binary, whatever the mount.

Max.

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