public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* [ANN] cyg-wrapper.sh
@ 2002-12-05 19:33 Luc Hermitte
  2002-12-07 23:43 ` Soren A
  2002-12-10  8:59 ` [ANN] cyg-wrapper.sh Matt Armstrong
  0 siblings, 2 replies; 8+ messages in thread
From: Luc Hermitte @ 2002-12-05 19:33 UTC (permalink / raw)
  To: cygwin

Hello,


cyg-wrapper v2.2 has been uploaded on my web site:
    http://hermitte.free.fr/cygwin/#Win32
    http://hermitte.free.fr/cygwin/cyg-wrapper.sh


cyg-wrapper is a shell script that helps to run, from cygwin,
command-line applications that have been compiled for windows only ; ie:
applications un-aware and independant of the cygwin layer.[1] 

cyg-wrapper converts pathname arguments, passed to win32 programs, from
the written form (unix/dos/windows ; relative or absolute) to the DOS
(short [2] ; and absolute) form that win32 command-line programs
understand.

It extends what cygpath do, to every pathname arguments, and resolves
the symbolic links.


A typical way of use is for instance:
  alias gvim='cyg-wrapper.sh "C:/Progra~1/Edition/vim/vim61/gvim.exe" 
     -binary-opt=-c,--cmd,-T,-t,--servername,--remote-send,--remote-expr
     --fork=1'
that defines the alias 'gvim' which:
  - calls the win32 version of Gvim,
  - converts every pathname argument (identified as beeing those that do
    not begin with '+' or '-', and that do not directly follow '-c',
    '--cmd', '-T', ...)
  - forks immediately ; which replaces the disabled '-f' option of the
    win32 version of gvim.


Note: the latest version of cyg-wrapper requires cygUtils and more
precisally realpath. An older but slower version is also available on
my web site.

Feedback appreciated.


[1] BTW, Is there a canonical expression to designate such applications ?
    I tend to use "native win32 applications/programs", but I'm not sure
    it is really correct in English.
[2] This form has been privileged because of the MsWindows 9x series.
-- 
Luc Hermitte

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ANN] cyg-wrapper.sh
  2002-12-05 19:33 [ANN] cyg-wrapper.sh Luc Hermitte
@ 2002-12-07 23:43 ` Soren A
  2002-12-08 11:49   ` [ANN] cyg-wrapper.sh Luc Hermitte
  2002-12-10  8:59 ` [ANN] cyg-wrapper.sh Matt Armstrong
  1 sibling, 1 reply; 8+ messages in thread
From: Soren A @ 2002-12-07 23:43 UTC (permalink / raw)
  To: cygwin

Luc Hermitte <hermitte@free.fr> wrote around 05 Dec 2002 
news:20021206013757.GA976927@ORLYN:

> cyg-wrapper v2.2 has been uploaded on my web site:
>     http://hermitte.free.fr/cygwin/#Win32
>     http://hermitte.free.fr/cygwin/cyg-wrapper.sh
Luc posted on my urging; please check out his site and this script which is 
a useful and good piece of hackery.

> cyg-wrapper is a shell script that helps to run, from cygwin,
> command-line applications that have been compiled for windows only ; ie:
> applications un-aware and independant of the cygwin layer.[1] 
> 
> cyg-wrapper converts pathname arguments, passed to win32 programs, from
> the written form (unix/dos/windows ; relative or absolute) to the DOS
> (short [2] ; and absolute) form that win32 command-line programs
> understand.
> 
> It extends what cygpath do, to every pathname arguments, and resolves
> the symbolic links.
> 
> 
> A typical way of use is for instance:
>   alias gvim='cyg-wrapper.sh "C:/Progra~1/Edition/vim/vim61/gvim.exe" 
>      -binary-opt=-c,--cmd,-T,-t,--servername,--remote-send,--remote-expr
>      --fork=1'
> that defines the alias 'gvim' which:
>   - calls the win32 version of Gvim,
>   - converts every pathname argument (identified as beeing those that do
>     not begin with '+' or '-', and that do not directly follow '-c',
>     '--cmd', '-T', ...)
>   - forks immediately ; which replaces the disabled '-f' option of the
>     win32 version of gvim.
> 
> 
> Note: the latest version of cyg-wrapper requires cygUtils and more
> precisally realpath. An older but slower version is also available on
> my web site.
> 
> Feedback appreciated.
I am going to be making cyg-wrapper.sh a part of my bash inifiles, as I
discover uses for it. That is, i'll define aliaii like the above example
to GVIM, in my ~/.profile or ~/.bashrc. 

> [1] BTW, Is there a canonical expression to designate such applications ?
>     I tend to use "native win32 applications/programs", but I'm not sure
>     it is really correct in English.
"Dumb Software" ? ;-). No, the way you wrote it seems proper to me. I don't 
know of a better widely-understood terminology, but I wish there was one, 
because this is an issue I deal with a lot. I use a lot of cross-platform 
software where the application understands a path argument passed to it 
like this:

  someunixyapp -flag1 -flagn C:/datafiles/forwardslashed/data.data

And I have seen here these kinds of path specs called "mixed" paths,
because while they are not POSIX (single-rooted filesystem) they use
forward slashes. Yet people commonly refer to many apps that understand
these kinds of paths (as does the OS itself, in fact, but not its native
shells) as "Native Win32 ports". In this respect there is a further
level of "nativeness" (or really, "dumbness") that could be specified,
but we have no custom or convenient nomenclature for doing so. 

> [2] This form has been privileged because of the MsWindows 9x series.

Hmmm. If you mean that people who run Win9x are more likely to be
running old DOS programs that use 8.3, then ok; otherwise there's no
difference between NT-derived and 9x-type Windows in this respect --
that I know of. 

  Best,
   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"



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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ANN] Re: cyg-wrapper.sh
  2002-12-07 23:43 ` Soren A
@ 2002-12-08 11:49   ` Luc Hermitte
  2002-12-09 15:44     ` Soren A
  0 siblings, 1 reply; 8+ messages in thread
From: Luc Hermitte @ 2002-12-08 11:49 UTC (permalink / raw)
  To: cygwin

* On Sun, Dec 08, 2002 at 07:13:44AM +0000, Soren A <soren_andersen@fastmail.fm> wrote:
> Luc posted on my urging; please check out his site and this script
> which is a useful and good piece of hackery.

Thanks :-)

> > [2] This form has been privileged because of the MsWindows 9x
> > series.
> 
> Hmmm. If you mean that people who run Win9x are more likely to be
> running old DOS programs that use 8.3, then ok; otherwise there's no
> difference between NT-derived and 9x-type Windows in this respect --
> that I know of. 

No. This is a scripting problem I had on MsWindows Me, and I don't
remember any similar issue on Windows NT -- more tests should be done to
be sure.

The problem comes from pathnames having spaces. If we want to run:
    appl "c:/Program Files/foo.txt" ~/bar.txt
The parameters should be requoted before (/while ?) running xargs. I
haven't spent enough time to find to something that works.

-- 
Luc Hermitte

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ANN] Re: cyg-wrapper.sh
  2002-12-08 11:49   ` [ANN] cyg-wrapper.sh Luc Hermitte
@ 2002-12-09 15:44     ` Soren A
  0 siblings, 0 replies; 8+ messages in thread
From: Soren A @ 2002-12-09 15:44 UTC (permalink / raw)
  To: cygwin

Luc Hermitte <hermitte@free.fr> wrote around 08 Dec 2002 
news:20021208193753.GA44134983@ORLYN:

>> > [2] This form has been privileged because of the MsWindows 9x
>> > series.
>> 
>> Hmmm. If you mean that people who run Win9x are more likely to be
>> running old DOS programs that use 8.3, then ok; otherwise there's no
>> difference between NT-derived and 9x-type Windows in this respect --
>> that I know of. 
> 
> No. This is a scripting problem I had on MsWindows Me, and I don't
> remember any similar issue on Windows NT -- more tests should be done to
> be sure.
> 
> The problem comes from pathnames having spaces. If we want to run:
>     appl "c:/Program Files/foo.txt" ~/bar.txt
> The parameters should be requoted before (/while ?) running xargs. I
> haven't spent enough time to find to something that works.

Yes. I am pretty sure that you'll have the same problem with pathnames
containing spaces on NT & its derivatives, too. So having the wrapper
generate the 8.3 form of the name probably isn't a bad idea, at least as
far as this issue goes. There might be other (side) effects. 

Not to seem like I am competing with you or upstaging you, Luc, but I
want to announce (bec. I am assuming the readers of this thread might
have interest) that I have done my own WWW publication about how I start
(instantiate) GVIM from Cygwin's bash shell: 

  http://home.att.net/~perlspinr/vim/VIMhelpers.html

It doesn't use your cyg-wrapper script because I wanted to do some more
elaborate stuff. 

Readers "shopping" for a test editor to use in conjunction with Cygwin
are encouraged to check out GVIM 6.x (www.vim.org) -- it rocks. And then
use my script to run it from bash ;-).

  Best,
   Soren

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



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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ANN] cyg-wrapper.sh
  2002-12-05 19:33 [ANN] cyg-wrapper.sh Luc Hermitte
  2002-12-07 23:43 ` Soren A
@ 2002-12-10  8:59 ` Matt Armstrong
  2002-12-12 18:59   ` [ANN] cyg-wrapper.sh Luc Hermitte
  1 sibling, 1 reply; 8+ messages in thread
From: Matt Armstrong @ 2002-12-10  8:59 UTC (permalink / raw)
  To: cygwin

Luc Hermitte <hermitte@free.fr> writes:

> cyg-wrapper v2.2 has been uploaded on my web site:
>     http://hermitte.free.fr/cygwin/#Win32
>     http://hermitte.free.fr/cygwin/cyg-wrapper.sh
>
> cyg-wrapper is a shell script that helps to run, from cygwin,
> command-line applications that have been compiled for windows only ; ie:
> applications un-aware and independant of the cygwin layer.[1] 
>
> cyg-wrapper converts pathname arguments, passed to win32 programs, from
> the written form (unix/dos/windows ; relative or absolute) to the DOS
> (short [2] ; and absolute) form that win32 command-line programs
> understand.

Luc, you might consider adding an option to unset the PWD environment
variable (or convert it to a Windows path).

The Perforce (http://www.perforce.com/) p4.exe will barf if PWD is
still set to a cygwin path.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ANN] Re: cyg-wrapper.sh
  2002-12-10  8:59 ` [ANN] cyg-wrapper.sh Matt Armstrong
@ 2002-12-12 18:59   ` Luc Hermitte
  2002-12-16 19:04     ` Matt Armstrong
  0 siblings, 1 reply; 8+ messages in thread
From: Luc Hermitte @ 2002-12-12 18:59 UTC (permalink / raw)
  To: cygwin

Hello Matt,

* On Tue, Dec 10, 2002 at 09:38:02AM -0700, Matt Armstrong <matt@lickey.com> wrote:
> Luc, you might consider adding an option to unset the PWD environment
> variable (or convert it to a Windows path).

That's done. I haven't done any test with perforce, so, let me know.

The two new options are:
    --cyg-PWD-clear   : to unset PWD 
    --cyg-PWD-convert : to convert PWD to its DOS (short) form.

I was considering to handle other environment variables, but I didn't
see any good candidate -- ie. environment variables specific to bash or
cygwin that win32 native applications may also use.

-- 
Luc Hermitte

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ANN] Re: cyg-wrapper.sh
  2002-12-12 18:59   ` [ANN] cyg-wrapper.sh Luc Hermitte
@ 2002-12-16 19:04     ` Matt Armstrong
  2002-12-17  8:33       ` Luc Hermitte
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Armstrong @ 2002-12-16 19:04 UTC (permalink / raw)
  To: cygwin

Luc Hermitte <hermitte@free.fr> writes:

> Hello Matt,
>
> * On Tue, Dec 10, 2002 at 09:38:02AM -0700, Matt Armstrong
> * <matt@lickey.com> wrote:
>> Luc, you might consider adding an option to unset the PWD environment
>> variable (or convert it to a Windows path).
>
> That's done. I haven't done any test with perforce, so, let me know.
>
> The two new options are:
>     --cyg-PWD-clear   : to unset PWD 
>     --cyg-PWD-convert : to convert PWD to its DOS (short) form.
>
> I was considering to handle other environment variables, but I
> didn't see any good candidate -- ie. environment variables specific
> to bash or cygwin that win32 native applications may also use.

SHELL.

Today I discovered the NT port of emacs uses "SHELL" if set, so it
ends up getting its shell set to /usr/bin/zsh.  Emacs looks for
c:\usr\bin\zsh.exe, but it is really c:\cygwin\usr\bin\zsh.exe.

The solution was to clear the SHELL env var, since I didn't want emacs
using my cygwin shell.

HOME is also probably a good idea to convert into DOS form.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ANN] Re: cyg-wrapper.sh
  2002-12-16 19:04     ` Matt Armstrong
@ 2002-12-17  8:33       ` Luc Hermitte
  0 siblings, 0 replies; 8+ messages in thread
From: Luc Hermitte @ 2002-12-17  8:33 UTC (permalink / raw)
  To: Matt Armstrong; +Cc: cygwin

* On Mon, Dec 16, 2002 at 05:12:56PM -0700, Matt Armstrong <matt@lickey.com> wrote:
> >     --cyg-PWD-clear   : to unset PWD 
> >     --cyg-PWD-convert : to convert PWD to its DOS (short) form.
> >
> > I was considering to handle other environment variables, but I
> > didn't see any good candidate -- ie. environment variables specific
> > to bash or cygwin that win32 native applications may also use.
> 
> SHELL.
> 
> The solution was to clear the SHELL env var, since I didn't want emacs
> using my cygwin shell.

It is possible to alias emacs to:
    alias emacs='(unset SHELL; cygwrapper.sh path-to-emacs ...)'

> HOME is also probably a good idea to convert into DOS form.

That's odd. $HOME correctly appear with Vim.

Any way, --cyg-PWD-clear and --cyg-PWD-convert have been replaced with:
--cyg-env-clear=ENV-VARS and --cyg-env-convert=ENV-VARS.

So, you can write now:
    alias prog='cyg-wrapper.sh path-to-prog
	--cyg-env-convert=PWD,SHELL --cyg-env-convert=HOME'

However, I have a bug: "--cyg-env-convert=HOMEPATH" works fine,
"--cyg-env-clear=PWD" works fine too, but "--cyg-env-convert=HOMEPATH"
does not have any consequences... As well as "(unset HOMEPATH;gvim)". I
guess that HOMEPATH got a special traitment from cygwin or bash.

Does list of directories needs to be converted also ? I know PATH
appears correctly converted from Vim. Is is the same with the other
tools, or is it Vim, as I suspect, that opers the convertion ?

-- 
Luc Hermitte
http://hermitte.free.fr/cygwin/

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-12-17 16:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-05 19:33 [ANN] cyg-wrapper.sh Luc Hermitte
2002-12-07 23:43 ` Soren A
2002-12-08 11:49   ` [ANN] cyg-wrapper.sh Luc Hermitte
2002-12-09 15:44     ` Soren A
2002-12-10  8:59 ` [ANN] cyg-wrapper.sh Matt Armstrong
2002-12-12 18:59   ` [ANN] cyg-wrapper.sh Luc Hermitte
2002-12-16 19:04     ` Matt Armstrong
2002-12-17  8:33       ` Luc Hermitte

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