public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Igor Pechtchanski <pechtcha@cs.nyu.edu>
To: cygwin@cygwin.com
Subject: Re: Finding exact case of paths
Date: Thu, 12 Sep 2002 17:52:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.44.0209122003380.19696-100000@slinky.cs.nyu.edu> (raw)
In-Reply-To: <3D812C51.C17EC79F@pajhome.org.uk>

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@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.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/

  reply	other threads:[~2002-09-13  0:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-12  7:28 Release candidate 1: /etc/hosts Paul Johnston
2002-09-12  8:13 ` Gerrit P. Haase
2002-09-12 10:49 ` Igor Pechtchanski
2002-09-12 10:53   ` Nicholas Wourms
2002-09-12 11:16     ` Igor Pechtchanski
2002-09-12 11:15   ` Nicholas Wourms
2002-09-12 11:33     ` Igor Pechtchanski
2002-09-12 11:29   ` Paul Johnston
2002-09-12 11:42     ` Igor Pechtchanski
2002-09-12 11:44       ` Paul Johnston
2002-09-12 15:01         ` Igor Pechtchanski
2002-09-12 17:16           ` Finding exact case of paths Paul Johnston
2002-09-12 17:52             ` Igor Pechtchanski [this message]
2002-09-12 20:14               ` Igor Pechtchanski
2002-09-13  1:12                 ` Igor Pechtchanski
2002-09-13  5:58                   ` Release candidate 2: /etc/hosts Paul Johnston
2002-09-13  7:38                     ` Igor Pechtchanski
2002-09-15  2:47                       ` Installing cygwin-mketc.sh Paul Johnston
2002-09-15  5:53                         ` John Morrison
2002-09-15  6:49                         ` John Morrison
2002-09-15  7:17                           ` John Morrison
2002-09-15  9:44                             ` Igor Pechtchanski
2002-09-15  9:28                         ` Igor Pechtchanski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.4.44.0209122003380.19696-100000@slinky.cs.nyu.edu \
    --to=pechtcha@cs.nyu.edu \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).