[Mingw-msys] Re: Is there a MinGW winapi macro defined?
- Date: Sat, 17 Jul 2010 19:28:28 +0100
- From: Andy Koppe <andy.koppe@xxxxxxxxx>
- Subject: Re: [Mingw-msys] mintty 0.8-beta1 for MSYS
On 17 July 2010 14:18, Cesar Strauss wrote:
> On 11/7/2010 15:33, Andy Koppe wrote:
>> As previously mentioned by Chris Sutcliffe, Chris and I have been
>> working on a port of the mintty terminal emulator to MSYS.
>> Chris intends to create a proper MSYS
>> package once 0.8 proves sufficiently stable.
> Looking forward to it.
>> Feedback on the beta version would be much appreciated.
> Working fine so far.
I've got a couple of questions on handling the HOME variable.
Mintty needs to know the user's home directory to be able to
load/store its settings from/to ~/.minttyrc. HOME is set in
/etc/profile, but unfortunately that's too late for mintty, since of
course the profile is only sourced by the shell invoked by mintty.
Therefore, if HOME isn't set, mintty assumes that the user's home
directory is at /home/<loginname>, whereby the login name is obtained
through getlogin(). Is that reasonable?
Futhermore, I noticed that it makes a difference how bash is told to
act as a login shell. From the bash manual: "A login shell is one
whose first character of argument zero is a -, or one started with
the --login option." If invoked with the --login option, things behave
as expected and HOME ends up being set to /home/$LOGNAME by
/etc/profile. Yet if it's invoked with argv set to "-bash", HOME is
set to / (i.e. the root directory) before /etc/profile is sourced.
This can be seen by going to the MSYS bin directory in a cmd prompt
and running 'rxvt -ls', or by copying bash to '-bash' and invoking
that. Any idea why this happens?
Same thing would happen with mintty if invoked with 'mintty -' (which
in the same way as rxvt's -ls option prepends a '-' to the user's
default shell), except that I've added a hack that sets HOME to
/home/<loginname> if it's not already set. But on second thoughts,
mintty shouldn't really be doing that. So should I remove that hack?
The upshot of that would simply be that any shortcut or script for
invoking mintty would need to do 'mintty /bin/bash -l' instead of
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
Mingw-msys mailing list