question about execv

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

question about execv

Chris Sutcliffe-2
Hi All,

I'm working with Andy Koppe to port mintty to MSYS and I've hit a bit
of snag.  One of the features of mintty is to spawn a new terminal
window from within itself.  To that end, for Cygwin, mintty uses:

     execv("/proc/self/exe", argv);

Since MSYS doesn't have the /proc filesystem, what I've come up with is:

    char path[MAX_PATH];
    realpath(argv[0], path);
    execv(path, argv);

Which works well if mintty is spawned from within an MSYS console.
The problem is that if mintty is run directly from within Windows
(i.e. via a 'Run' dialogue), execv fails.  I assume because it doesn't
like the path:

C:/msys/1.0/bin/mintty.exe

Is there an internal MSYS function to convert the path to a 'native' MSYS path?

Thank you,

Chris

--
Chris Sutcliffe
http://emergedesktop.org
http://www.google.com/profiles/ir0nh34d

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Mingw-msys mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-msys
Reply | Threaded
Open this post in threaded view
|

Re: question about execv

Chris Sutcliffe-2
On 15 June 2010 14:45, Chris Sutcliffe wrote:
> Is there an internal MSYS function to convert the path to a 'native' MSYS path?

The issue wasn't the path style, it was the quotes around the path.  I
have it working now.

Chris

--
Chris Sutcliffe
http://emergedesktop.org
http://www.google.com/profiles/ir0nh34d

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Mingw-msys mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-msys
Reply | Threaded
Open this post in threaded view
|

Re: question about execv

Vincent Torri-2
In reply to this post by Chris Sutcliffe-2


On Tue, 15 Jun 2010, Chris Sutcliffe wrote:

> Hi All,
>
> I'm working with Andy Koppe to port mintty to MSYS and I've hit a bit
> of snag.  One of the features of mintty is to spawn a new terminal
> window from within itself.  To that end, for Cygwin, mintty uses:

Just to satisfy my curiosity, is it to get rid of cygwin and just provide
a native executable for mintty, or is it for a future replacement of the
current MSYS terminal ?

Vincent Torri

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Mingw-msys mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-msys
Reply | Threaded
Open this post in threaded view
|

Re: question about execv

Chris Sutcliffe-2
On 15 June 2010 18:34, Vincent Torri wrote:
>> I'm working with Andy Koppe to port mintty to MSYS and I've hit a bit
>> of snag.  One of the features of mintty is to spawn a new terminal
>> window from within itself.  To that end, for Cygwin, mintty uses:
>
> Just to satisfy my curiosity, is it to get rid of cygwin and just provide
> a native executable for mintty, or is it for a future replacement of the
> current MSYS terminal ?

Out of my own interest really, given that I'm not a big fan of rxvt or
the Windows console.  Andy and I had discussed it a while back
(porting mintty to MSYS), but due the old gcc (2.95 at the time), it
was problematic.  With Cesar's work getting gcc to 3.4.4 for MSYS, we
now have a suitable compiler to port mintty.

As to mintty being the future terminal for MSYS, I really can't
comment.  If nothing else, it will give us options for MSYS.

I still use Cygwin for other activities, and MSYS for MinGW related
activities, so I liked the concept of having a powerful native
terminal that I could use for both that shared a common configuration
between environments.

Chris

>
> Vincent Torri
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Mingw-msys mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mingw-msys
>



--
Chris Sutcliffe
http://emergedesktop.org
http://www.google.com/profiles/ir0nh34d

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Mingw-msys mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-msys
Reply | Threaded
Open this post in threaded view
|

Re: question about execv

Charles Wilson-8
In reply to this post by Chris Sutcliffe-2
On 6/15/2010 2:45 PM, Chris Sutcliffe wrote:
> I'm working with Andy Koppe to port mintty to MSYS

Wow. You are a brave, brave man.  mintty seems to rely so heavily on
cygwin-1.7's i18n support that I didn't think it would be possible --
without *significantly* hacking up the code -- to port to msys,
regardless of what version of msys-gcc is used.

But if you and Andy think it is possible, then I think it's a great
idea. (Now, no doubt some will disagree, since mintty shares with rxvt
the "pty" problem -- which cmd.exe and console(2) do not).

But anything that helps "retire" rxvt sooner is all to the good, IMO.
rxvt is a dead parrot. Joined the choir invisible. Shuffled off this
mortal coil...

> Is there an internal MSYS function to convert the path to a 'native' MSYS path?

Yes, they are the same as the old cygwin-1.5-era functions <sys/cygwin.h>:

extern int cygwin_win32_to_posix_path_list (const char *, char *);
extern int cygwin_win32_to_posix_path_list_buf_size (const char *);
extern int cygwin_posix_to_win32_path_list (const char *, char *);
extern int cygwin_posix_to_win32_path_list_buf_size (const char *);
extern int cygwin_conv_to_win32_path (const char *, char *);
extern int cygwin_conv_to_full_win32_path (const char *, char *);
extern int cygwin_conv_to_posix_path (const char *, char *);
extern int cygwin_conv_to_full_posix_path (const char *, char *);

--
Chuck

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Mingw-msys mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-msys
Reply | Threaded
Open this post in threaded view
|

Re: question about execv

Chris Sutcliffe-2
On 15 June 2010 23:29, Charles Wilson wrote:
> Wow. You are a brave, brave man.  mintty seems to rely so heavily on
> cygwin-1.7's i18n support that I didn't think it would be possible --
> without *significantly* hacking up the code -- to port to msys,
> regardless of what version of msys-gcc is used.

It's already working in the mintty 'trunk'.  Since mintty's code base
was originally designed to work with cygwin-1.5, there was not a lot
of MSYS specific changes required.  Granted the i18n stuff is a little
irrelevant, since the underlying MSYS dll doesn't support it.

The majority of the issues stem from the lack of the /proc filesystem
under MSYS.   I had to introduce a work around for the Alt+F2 function
and some other features don't work quite as well as they do under
Cygwin (Ctrl+clicking on a filename for example), but I'm using it for
my day-to-day MSYS work without issue.

> But if you and Andy think it is possible, then I think it's a great
> idea. (Now, no doubt some will disagree, since mintty shares with rxvt
> the "pty" problem -- which cmd.exe and console(2) do not).

Corresponding with Andy, once he considers 0.8 complete, I plan on
releasing it for MSYS as well.  As you pointed out, mintty does suffer
from the same 'pty' issue as rxvt.

> But anything that helps "retire" rxvt sooner is all to the good, IMO.
> rxvt is a dead parrot. Joined the choir invisible. Shuffled off this
> mortal coil...

Amen to that!

Chris

--
Chris Sutcliffe
http://emergedesktop.org
http://www.google.com/profiles/ir0nh34d

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Mingw-msys mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-msys