delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/13/09:47:00.1

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-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Thu, 12 Sep 2002 20:12:13 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: Re: Finding exact case of paths
In-Reply-To: <3D812C51.C17EC79F@pajhome.org.uk>
Message-ID: <Pine.GSO.4.44.0209122003380.19696-100000@slinky.cs.nyu.edu>
MIME-Version: 1.0

On Fri, 13 Sep 2002, Paul Johnston wrote:

> > Oh, I see, add a modifier similar to '-s', so that it verifies the case of
> > each element in the path...  Yeah, that could work, something like:
> >   -e, --exact-case      print exact case of NAME
>
> Yep, exactly. Now, cygpath seems to generally not hit the filesystem -
> cygpath c:/complete/crap gives me /c/complete/crap so using that switch
> will necessarily involve a performance hit. Given that, I think I'm
> happy with my solution based on dirent/strcasecmp. I've attached a
> stand-alone utility that seems to work (just on cygwin paths), although
> it has the side effect of squishing down multiple slashes
> ///like////this//path down to /like/this/path.
>
> I think it would be ok to restrict --exact-case to cygwin paths.

I don't think there's a need to search the directory yourself.  Upon
browsing the cygpath code some more, I realized that it is doing exactly
what we need (i.e. convert to the exact path) when returning the system
directory (the '-S' flag).  Quoting the code (cygpath.cc:396):

    case 'S':
      GetSystemDirectory (buf, MAX_PATH);
      FindFirstFile (buf, &w32_fd);
      strcpy (strrchr (buf, '\\') + 1, w32_fd.cFileName);
      break;

So we can do the same trick with each filename when our option ('-e') is
in effect.  I'm looking at a fix to cygpath now, and will submit a patch
as soon as I have it ready.

On a separate note, I found that "cygpath -l -w <path>" does not work on
my Win2k SP2 system, returning the same garbage (hex 20 FB 22 0a)
regardless of the path.  Anyone else have that problem?
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file


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

- Raw text -


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