Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 Subject: Re: example needed pls: `cygpath -c ' Date: Wed, 2 Jul 2003 10:55:46 +0000 (UTC) Organization: Occasionally Sporadically Lines: 198 Message-ID: References: <3EFE120B DOT 58A0C79E AT dessent DOT net> <20030701040434 DOT GE7604 AT ny-kenton2a-710 DOT buf DOT adelphia DOT net> <3F018740 DOT B28F53DC AT dessent DOT net> <3F018D6C DOT EA1226CA AT dessent DOT net> <3F021C46 DOT C8F4CE31 AT dessent DOT net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="==_=_====____37804.28906122693B7F707B==" X-Complaints-To: usenet AT main DOT gmane DOT org User-Agent: Xnews/L5 X-Archive: encrypt Brian Dessent wrote around 01 Jul 2003 news:3F021C46 DOT C8F4CE31 AT dessent DOT net: > I think by default it tries to use short-filenames in some cases, and > so %L means the same as %1 except it uses long file names. Well you are so right. And your knowledge about this stuff inspired me to forge onward in pursuit of inspiration. I have dressed up your .reg file a bit (heheh) and now give it back to you ... mutated beyond recognition ... (also attached to posting, so don't sweat) ----- 8< ----- snip and de-indent and de-wrap ----- 8< ----- REGEDIT4 [HKEY_CLASSES_ROOT\Directory\shell\CygPathLFN] @="&Copy LFN Cygwin Path" [HKEY_CLASSES_ROOT\Directory\shell\CygPathLFN\Command] @=hex(2):22,25,43,59,47,52,4f,4f,54,25,5c,5c,62,69,6e,5c,5c,62,61,73,68,20 ,2d,63,20,5c,22,65,63,68,6f,20,2d,6e,20,60,2f,62,69,6e,2f,63,79,67,70,61,74 ,68,20,2d,75,20,27,25,6c,27,60,3e,2f,64,65,76,2f,63,6c,69,70,62,6f,61,72,64 ,5c,22,22,d,00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathLFN] @="&Copy LFN Cygwin path" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathLFN\command] @=hex(2):22,25,43,59,47,52,4f,4f,54,25,5c,5c,62,69,6e,5c,5c,62,61,73,68,20 ,2d,63,20,5c,22,65,63,68,6f,20,2d,6e,20,60,2f,62,69,6e,2f,63,79,67,70,61,74 ,68,20,2d,75,20,27,25,6c,27,60,3e,2f,64,65,76,2f,63,6c,69,70,62,6f,61,72,64 ,5c,22,22,d,00 [HKEY_CLASSES_ROOT\Directory\shell\CygPathSFN] @="&Copy SFN Cygwin Path" [HKEY_CLASSES_ROOT\Directory\shell\CygPathSFN\Command] @=hex(2):22,25,43,59,47,52,4f,4f,54,25,5c,5c,62,69,6e,5c,5c,62,61,73,68,20 ,2d,63,20,5c,22,65,63,68,6f,20,2d,6e,20,60,2f,62,69,6e,2f,63,79,67,70,61,74 ,68,20,2d,75,20,27,25,31,27,60,3e,2f,64,65,76,2f,63,6c,69,70,62,6f,61,72,64 ,5c,22,22,d,00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathSFN] @="&Copy SFN Cygwin path" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathSFN\command] @=hex(2):22,25,43,59,47,52,4f,4f,54,25,5c,5c,62,69,6e,5c,5c,62,61,73,68,20 ,2d,63,20,5c,22,65,63,68,6f,20,2d,6e,20,60,2f,62,69,6e,2f,63,79,67,70,61,74 ,68,20,2d,75,20,27,25,31,27,60,3e,2f,64,65,76,2f,63,6c,69,70,62,6f,61,72,64 ,5c,22,22,d,00 ----- 8< ----- snip and de-indent and de-wrap ----- 8< ----- OK, "what's UP with this bizarre thing?" It is a REG_EXPAND_SZ -type REGEDIT .reg file instead of using easy REG_SZ -type entries. The expansion encoded is of a variable %CYGROOT% which must be present in the Windows "master" environment, so that the Registry _always_ has access to it. I set it in my Windows9x autoexec.bat file of course, and under NT/2K/XP you can use the ControlPanel|System. I really feel that %CYGROOT% is a broadly useful thing to do. Point it at the top (mounted as /) of your Cygwin installation and you'll always have programmatic access to the Cygwin location from outside in the 'doze wilderness. It's always nice to know where your safe haven is located, no? This is a typical Cygwin installation example of %CYGROOT%: SET CYGROOT=C:\cygwin (in autoexec.bat). So when I run the file above (I named it "CygPathExpandSZ.reg"), the Registry entries thus created are expanded with the result that whatever is in %CYGROOT% gets prepended to locate bash in cygwin's /bin. This makes your .reg concept portable without manual editing, to any system that has the %CYGROOT% variable defined in the env (obviously that's not very many since this isn't any part of Official Cygwin). Since you cannot (easily) read it you'll have to trust me that what I've described is what it does ;-). But here's the file _before_ creating the right kind of entries (this *will not work* as a .REG file, it could be termed "Registry psuedo-code"): ----- 8< ----- snip ----- 8< ----- !nope!REGEDIT4 messed up by my news client! [HKEY_CLASSES_ROOT\Directory\shell\CygPathLFN] @="&Copy LFN Cygwin Path" [HKEY_CLASSES_ROOT\Directory\shell\CygPathLFN\Command] @="%CYGROOT%\\bin\\bash -c \"echo -n `/bin/cygpath -u '%l'`>/dev/clipboard\" " [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathLFN] @="&Copy LFN Cygwin pa th" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathLFN\command] @="%CYGROOT%\\bin\\bash -c \"echo -n `/bin/cygpath -u '%l'`>/dev/clipboa rd\"" [HKEY_CLASSES_ROOT\Directory\shell\CygPa thSFN] @="&Copy SFN Cygwi n Path" [HKEY_CLASSES_ROOT\Directory\shell\CygPathSFN\Command] @="%CYGROOT%\\bin\\bash -c \"echo -n `/bin/cygpath -u '%1'`>/dev/cli pboard\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathSFN] @="&Copy SFN C ygwin path" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathSFN\command] @="%CYGROOT%\\bin\\bash -c \"echo -n `/bin/cygpath -u '%1'`>/de v/clipboard\"" ----- 8< ----- snip ----- 8< ----- I manually calculated all the hex bytes with a slide rule. Hah! What a liar! Actually I wrote a Perl tool to generate the REG_EXPAND_SZ entries needed. That tool is attached to this message and can also be seen discussed on perlmonks.org (hint: monk "Intrepid"). Best Regards, Soren A. -- "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 --==_=_====____37804.28906122693B7F707B== Content-Type: application/octet-stream; name="CygPathExpandSZ.reg" Content-Transfer-Encoding: base64 UkVHRURJVDQNCg0KW0hLRVlfQ0xBU1NFU19ST09UXERpcmVjdG9yeVxzaGVs bFxDeWdQYXRoTEZOXQ0KQD0iJkNvcHkgTEZOIEN5Z3dpbiBQYXRoIg0KDQpb SEtFWV9DTEFTU0VTX1JPT1RcRGlyZWN0b3J5XHNoZWxsXEN5Z1BhdGhMRk5c Q29tbWFuZF0NCkA9aGV4KDIpOjIyLDI1LDQzLDU5LDQ3LDUyLDRmLDRmLDU0 LDI1LDVjLDVjLDYyLDY5LDZlLDVjLDVjLDYyLDYxLDczLDY4LDIwLDJkLDYz LDIwLDVjLDIyLDY1LDYzLDY4LDZmLDIwLDJkLDZlLDIwLDYwLDJmLDYyLDY5 LDZlLDJmLDYzLDc5LDY3LDcwLDYxLDc0LDY4LDIwLDJkLDc1LDIwLDI3LDI1 LDZjLDI3LDYwLDNlLDJmLDY0LDY1LDc2LDJmLDYzLDZjLDY5LDcwLDYyLDZm LDYxLDcyLDY0LDVjLDIyLDIyLGQsMDANCg0KW0hLRVlfTE9DQUxfTUFDSElO RVxTT0ZUV0FSRVxDbGFzc2VzXCpcc2hlbGxcQ3lnUGF0aExGTl0NCkA9IiZD b3B5IExGTiBDeWd3aW4gcGF0aCINCg0KW0hLRVlfTE9DQUxfTUFDSElORVxT T0ZUV0FSRVxDbGFzc2VzXCpcc2hlbGxcQ3lnUGF0aExGTlxjb21tYW5kXQ0K QD1oZXg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iwyNSw0Myw1OSw0Nyw1Miw0Ziw0Ziw1NCwyNSw1 Yyw1Yyw2Miw2OSw2ZSw1Yyw1Yyw2Miw2MSw3Myw2OCwyMCwyZCw2MywyMCw1 YywyMiw2NSw2Myw2OCw2ZiwyMCwyZCw2ZSwyMCw2MCwyZiw2Miw2OSw2ZSwy Ziw2Myw3OSw2Nyw3MCw2MSw3NCw2OCwyMCwyZCw3NSwyMCwyNywyNSwzMSwy Nyw2MCwzZSwyZiw2NCw2NSw3NiwyZiw2Myw2Yyw2OSw3MCw2Miw2Ziw2MSw3 Miw2NCw1YywyMiwyMixkLDAwDQoNCn== --==_=_====____37804.28906122693B7F707B== Content-Type: application/octet-stream; name="REGexpandSZgen.p" Content-Transfer-Encoding: base64 IyEvdXNyL2Jpbi9wZXJsIC13CiMgIlJFR2V4cGFuZFNaZ2VuIiAtIGdlbmVy YXRlIHRoZSBmb3JtYXR0ZWQgaGV4IHN0cmluZyBmcm9tIGEgbm9ybWFsCiMg YXNjaWkgaW5wdXQgc3RyaW5nLCBmb3IgYSBSRUdFRElUIGZpbGU7IHRvIGVu dGVyIGEgUkVHX0VYUEFORF9TWgojIGRhdGEtdHlwZSBlbnRyeSBpbnRvIHRo ZSBNUyBXaW5kb3dzIFJlZ2lzdHJ5LgoKdXNlIHN0cmljdDsKbXkgJGVuY21l ID0gcG9wKEBBUkdWKSB8fCA8U1RESU4+OwppZigkZW5jbWUgPX5te14oIlte Il0rInxcQClcPSguKikkfSkgIHsKICMgIiBkb2VzIG5vdCBhcHBlYXIgd2hl cmUgImVudHJ5Ij0gQAogICAgJGVuY21lID0gWyQxLCAkMl07Cn0KbXkgJGN2 dGQgPSBbIG1hcCB7IHNwcmludGYgIiV4IixvcmQgfSBzcGxpdCgnJywKICAg ICAgICAgICAgICAgICAgIHJlZiAkZW5jbWUgPyAkZW5jbWUtPlsxXTokZW5j bWUpIF07CmlmKG5vdCAkQVJHVlswXSkgIHsKICAgIHByaW50ICcnLCAgKHJl ZiAkZW5jbWUgPyAiJGVuY21lLT5bMF09IjoiIiksCgkgICAgICAgICAgICJo ZXgoMik6Iiwgam9pbignLCcsQCRjdnRkLCcwMCcpLCAiXG4iOwp9IGVsc2Ug ewogICMgYW55IHByZXBlbmRlZCBhcmcgY2F1c2VzIHVzIHRvIAogICMgZGVi dWcgLyB0ZXN0IC8gdmVyaWZ5IHRoZSBzdHJpbmcuCiAgICBwcmludCAiXG4g SU46ICIsKHJlZiAkZW5jbWUgPyAkZW5jbWUtPlsxXTokZW5jbWUpLCJcbk9V VDogIgoJLCBwYWNrKCJjKiIsIG1hcChoZXgsIEAkY3Z0ZFswLi4oQCRjdnRk IC0gMHgxKV0pKQoJLCAiXG4iOwp9CgpfX0VORF9fCgpUaGlzIFByb2dyYW0g aXMgRnJlZSBTb2Z0d2FyZSwKKEMpMjAwMyBTb3JlbiBBbmRlcnNlbiA8c29t aWFuIC1BVC0gcG9ib3ggLURPVC0gY29tPgphbmQgaXQgbWF5IGJlIHVzZWQg dW5kZXIgdGhlIHNhbWUgdGVybXMgYXMgUGVybCBpdHNlbGYuCgo= --==_=_====____37804.28906122693B7F707B== Content-Type: text/plain; charset=us-ascii -- 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/ --==_=_====____37804.28906122693B7F707B==--