delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/20/14:48:03

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Resent-Message-Id: <200502201947 DOT j1KJlosg023868 AT links DOT magenta DOT com>
Date: Sun, 20 Feb 2005 14:17:24 -0500
From: Raul Miller <moth AT magenta DOT com>
To: cygwin AT cygwin DOT com
Subject: cygpath -m (and -w) sometimes emits multi-line names
Message-ID: <20050220141724.I32136@links.magenta.com>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5.1i
Resent-From: moth AT magenta DOT com
Resent-Date: Sun, 20 Feb 2005 14:47:50 -0500
Resent-To: cygwin AT cygwin DOT com

Manipluating the result of cygpath -m with shell tools is needlessly
difficult.

$ pwd
/cygdrive/c/Program Files/Mozilla Firefox/defaults/profile
$ cygpath -m `pwd`/bookmarks.htm | sed 's} }%20}g; s}^}file:///}'
file:///c:/Program
file:///Files/Mozilla
file:///Firefox/defaults/profile/bookmarks.htm
$ cygpath -v
cygpath (cygwin) 1.36
Path Conversion Utility
Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
Compiled on Nov 10 2004
$ grep = /cygwin.bat
set CYGWIN=export ntsec ntea title
$ 

I can't find any documentation on this "feature" of cygpath, and do
not know if it is intentional and/or if it solves some other problem.
If this behavior is intentional, it should be documented.

[And, yes, I can work around this problem in a variety of ways.
For example
 echo `pwd`/bookmarks.htm | sed 's}/cygdrive/c}file:///c:}; s} }%20}g;'
works just fine.  I can also pipe the output of cygpath through xargs
echo.  I can even write myself a shell script which will grab leading
option arguments and then iterate over all non-option arguments,
sticking `pwd` in front of each one that's not absolute and running
cygwin individually on all of those, wrapping cygwin's output in echo
and spitting the results out one per line (which would make cygpath
useful with wildcards, and fit the standard pattern for unix commands).
Of course all of these things could, at least in principle, be done in
the executable itself, too... which would eventually be easier to deal
with when I hop on random windows systems.  But perhaps someone thinks
the current awkward behavior was a good idea?]

Thanks,

-- 
Raul

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

- Raw text -


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