delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/06/28/14:47:29

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-Injected-Via-Gmane: http://gmane.org/
To: cygwin AT cygwin DOT com
From: Soren A <somian AT adelphia DOT net>
Subject: Re: example needed pls: `cygpath -c <HANDLE>'
Date: Sat, 28 Jun 2003 18:46:46 +0000 (UTC)
Organization: Occasionally Sporadically
Lines: 50
Message-ID: <Xns93A896696C0F8soren1Gmane@80.91.224.249>
References: <Xns93A88A37D41F9soren1Gmane AT 80 DOT 91 DOT 224 DOT 249> <3EFDDF97 DOT 29F49125 AT dessent DOT net>
X-Complaints-To: usenet AT main DOT gmane DOT org
User-Agent: Xnews/L5
X-Archive: encrypt

Brian Dessent <brian AT dessent DOT net> wrote around 28 Jun 2003
news:3EFDDF97 DOT 29F49125 AT dessent DOT net: 
[Soren A.:]
>> I am trying to finish a test script that uses ActivePerl to call
>> `cygpath` from itself (a system call, by open()-ing a pipe to capture
>> the output of the tool ...
>> 
>>   {... stuff ...}
>>   open(CTH, '-|', "C:/cygwin/bin/cygpath $MS_path_filename")
>>     or die "Could not open() call to 'cygpath', what is up?";
>>   $cygstyle_path = <CTH>;
>>   chomp $cygstyle_path;
>>   {... stuff ...}
> 
> If $MS_path_filename is indeed a regular Windows filename (with
> backslashes) you will need to either use quotemeta() or s!\\!/!g
> because singular backslashes will be removed during interpolation.

I know this. Already checked that what's being fed into `cygpath' is 
kosher.

I've spent 4+ hours debugging this script.

> Here's a little thing I cooked up that I find very useful, I call it
> dodos.  It lets you run any DOS/Windows program and call it with unix
> arguments.  For example, you could type "dodos notepad /etc/aliases"
> or "dodos notepad /etc/hosts.*" and you'd get what you expect.
> 
> #!/usr/bin/perl -w
> 
> my @newargs = $ARGV[0];
> 
> foreach my $arg (@ARGV[1..$#ARGV]) {
>         my $foo = quotemeta($arg);
>         $foo = `cygpath -wsa $foo 2>/dev/null`;
>         chomp $foo;
>         push @newargs, $foo;
> }
> 
> exec @newargs;
> 

Heh. Looks like a candidate for a Schwartzian Transform, or the Orcish 
Manuever, or something :-/. But good anyway. I'll add it to my toolset.

-- 
"So, tell me, my little one-eyed one, on what poor, pitiful,
defenseless planet has my MONSTROSITY been unleashed?"
                       - Dr. Jumba, Disney's "Lilo & Stitch"
OpenPGP Key at http://savannah.gnu.org/people/viewgpg.php?user_id=6050


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