Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
To: cygwin@cygwin.com
Subject: Re: Programatically finding value of "cygdrive" prefix
Mail-Copies-To: never
Reply-To: sds@gnu.org
X-Attribution: Sam
X-Disclaimer: You should not expect anyone to agree with me.
From: Sam Steingold <sds@gnu.org>
In-Reply-To: <20050810184119.GA6155@trixie.casa.cgf.cx> (Christopher Faylor's message of "Wed, 10 Aug 2005 14:41:19 -0400")
References: <42FA4604.8000507@tlinx.org> 	<20050810183616.GA5892@trixie.casa.cgf.cx> 	<20050810184119.GA6155@trixie.casa.cgf.cx>
Mail-Followup-To: cygwin@cygwin.com
Date: Thu, 11 Aug 2005 09:57:40 -0400
Message-ID: <u3bpglgob.fsf@gnu.org>
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt)
MIME-Version: 1.0
Content-Type: text/plain

> * Christopher Faylor <pts-ab-crefbany-ercyl-cyrnfr@pltjva.pbz> [2005-08-10 14:41:19 -0400]:
>
> On Wed, Aug 10, 2005 at 02:36:16PM -0400, Christopher Faylor wrote:
>>On Wed, Aug 10, 2005 at 11:23:00AM -0700, Linda W wrote:
>>>Is there a way to find out in a bash script the cygdrive prefix?
>>>I thought something simple like
>>>   mount -p|tail -1|cut -f1
>>>but that incorrectly assumed the fields were tab delimited.
>>>Since there can be spaces in the cygdrive prefix, I can't
>>>use space a delimiter, example:
>>># mount -p
>>>Prefix              Type         Flags
>>>/cyg drive posix path  system       binmode
>>>----
>>
>>There may be a simpler way to do it, but this seems to work:
>>
>>mount -p | sed -n '2s/\([^ ]\)  *[^ ][^ ]*  *[^ ][^ ]*$/\1/p'
>
> This is shorter:
>
> mount -p | sed -nr '2s/([^ ]) +\S+ +\S+$/\1/p'

how about a version that strips the leading slash?
(I can pipe this through "sed 's,^/,,'", but there is a simpler way, right?)

while we are at it, how do non-cygwin programs supposed to handle this
/cygdrive stuff?
shell scripts mindlessly transfered from unix to cygwin do not bother to
use cygpath before passing pathnames to external programs.
native Emacs or vim do not appreciate /cygdrive prefixes.
it's easier to tell Emacs how to handle /cygdrive than to fix every
elisp Makefile that is being distributed.
that brings me to suggest that this "cygdrive" be made available in the
registry (which cygwin does not use at all, so, I guess, this is not
going anywhere...)

thanks.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.mideasttruth.com/> <http://www.savegushkatif.org>
<http://www.iris.org.il> <http://www.camera.org> <http://ffii.org/>
Never underestimate the power of stupid people in large groups.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

