first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / production / msys / msys.bat
1 @echo off
2 rem Copyright (C):  2001, 2002, 2003, 2004, 2005  Earnie Boyd
3 rem   mailto:earnie@users.sf.net
4 rem This file is part of Minimal SYStem
5 rem   http://www.mingw.org/msys.shtml
6 rem
7 rem File:           msys.bat
8 rem Revision:       2.4
9 rem Revision Date:  December 8th, 2005
10
11 rem ember to set the "Start in:" field of the shortcut.
12 rem A value similar to C:\msys\1.0\bin is what the "Start in:" field needs
13 rem to represent.
14
15 rem ember value of GOTO: is used to know recursion has happened.
16 if "%1" == "GOTO:" goto %2
17
18 if NOT "x%WD%" == "x" set WD=
19
20 rem ember command.com only uses the first eight characters of the label.
21 goto _WindowsNT
22
23 rem ember that we only execute here if we are in command.com.
24 :_Windows
25
26 if "x%COMSPEC%" == "x" set COMSPEC=command.com
27 start /min %COMSPEC% /e:4096 /c %0 GOTO: _Resume %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
28 goto EOF
29
30 rem ember that we execute here if we recursed.
31 :_Resume
32 for %%F in (1 2 3) do shift
33 if NOT EXIST %WD%msys-1.0.dll set WD=.\bin\
34
35 rem ember that we get here even in command.com.
36 :_WindowsNT
37
38 rem Hopefully a temporary workaround for getting MSYS shell to run on x64
39 rem (WoW64 cmd prompt sets PROCESSOR_ARCHITECTURE to x86)
40 if not "x%PROCESSOR_ARCHITECTURE%" == "xAMD64" goto _NotX64
41 set COMSPEC=%WINDIR%\SysWOW64\cmd.exe
42 %COMSPEC% /c %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
43 goto EOF
44 :_NotX64
45
46 if NOT EXIST %WD%msys-1.0.dll set WD=%~dp0\bin\
47
48 rem ember Set up option to use rxvt based on value of %1
49 if "x%MSYSCON%" == "x" set MSYSCON=rxvt.exe
50 if "x%1" == "x-norxvt" set MSYSCON=sh.exe
51 if "x%1" == "x--norxvt" set MSYSCON=sh.exe
52 if "x%MSYSCON%" == "xsh.exe" shift
53
54 if "x%MSYSTEM%" == "x" set MSYSTEM=MINGW32
55 if "%1" == "MINGW32" set MSYSTEM=MINGW32
56 if "%1" == "MSYS" set MSYSTEM=MSYS
57
58 if NOT "x%DISPLAY%" == "x" set DISPLAY=
59
60 if "x%MSYSCON%" == "xrxvt.exe" goto startrxvt
61 if "x%MSYSCON%" == "xsh.exe" goto startsh
62
63 :unknowncon
64 echo %MSYSCON% is an unknown option for msys.bat.
65 pause
66 exit 1
67
68 :notfound
69 echo Cannot find the rxvt.exe or sh.exe binary -- aborting.
70 pause
71 exit 1
72
73 rem If you don't want to use rxvt then rename the file rxvt.exe to something
74 rem else.  Then sh.exe will be used instead.
75 :startrxvt
76 if NOT EXIST %WD%rxvt.exe goto startsh
77
78 rem Setup the default colors for rxvt.
79 if "x%MSYSBGCOLOR%" == "x" set MSYSBGCOLOR=White
80 if "x%MSYSFGCOLOR%" == "x" set MSYSFGCOLOR=Black
81 if "x%MINGW32BGCOLOR%" == "x" set MINGW32BGCOLOR=LightYellow
82 if "x%MINGW32FGCOLOR%" == "x" set MINGW32FGCOLOR=Navy
83 if "%MSYSTEM%" == "MSYS" set BGCOLOR=%MSYSBGCOLOR%
84 if "%MSYSTEM%" == "MSYS" set FGCOLOR=%MSYSFGCOLOR%
85 if "%MSYSTEM%" == "MINGW32" set BGCOLOR=%MINGW32BGCOLOR%
86 if "%MSYSTEM%" == "MINGW32" set FGCOLOR=%MINGW32FGCOLOR%
87
88 start %WD%rxvt -backspacekey \b -sl 2500 -fg %FGCOLOR% -bg %BGCOLOR% -sr -fn Courier-12 -tn msys -geometry 80x25 -e /bin/sh --login -i
89 exit
90
91 :startsh
92 if NOT EXIST %WD%sh.exe goto notfound
93 start %WD%sh --login -i
94 exit
95
96 :EOF
97
98 rem ChangeLog:
99 rem 2002.03.07  Earnie Boyd  mailto:earnie@users.sf.net
100 rem     * Move the @echo off to the top.
101 rem     * Change the binmode setting to nobinmode.
102 rem     * Remove the angle brackets around email address to workaround MS 
103 rem     buggy command processor.
104 rem
105 rem 2002.03.12  Earnie Boyd  mailto:earnie@users.sf.net
106 rem     * Add filter logic to find rxvt.exe
107 rem
108 rem 2002.03.13  Earnie Boyd  mailto:earnie@users.sf.net
109 rem     * Revert the nobinmode change.
110 rem
111 rem 2002.03.20  Earnie Boyd  mailto:earnie@users.sf.net
112 rem     * Add logic for stating bash.
113 rem
114 rem 2002.04.11  Earnie Boyd  mailto;earnie@users.sf.net
115 rem     * Add logic for setting MSYSTEM value based on parameter.
116 rem
117 rem 2002.04.15  Olivier Gautherot  mailto:olivier_gautherot@mentorg.com
118 rem     * Reduce number test conditions for finding an executable.
119 rem
120 rem 2002.04.15  Earnie Boyd  mailto:earnie@users.sf.net
121 rem     * Unset DISPLAY if set before starting shell.
122 rem
123 rem 2002.04.16  Earnie Boyd  mailto:earnie@users.sf.net
124 rem     * Remove use of DEFINED in conditional statments for variables for
125 rem     command.com support.
126 rem     * Add check for nonexistance of USERNAME variable for Win9x support.
127 rem
128 rem 2002.04.17  Earnie Boyd  mailto:earnie@users.sf.net
129 rem     * Add foreground and background color defaults based on MSYSTEM value.
130 rem
131 rem 2002.04.22  Earnie Boyd  mailto:earnie@users.sf.net
132 rem     * More Win 9x changes.
133 rem
134 rem 2002.05.04  Earnie Boyd  mailto:earnie@users.sf.net
135 rem     * Remove the SET of USERNAME and HOME.
136 rem
137 rem 2002.11.18  Earnie Boyd  mailto:earnie@users.sf.net
138 rem     * Add command.com detection and restart with a larger environment to
139 rem     avoid errors on w9x.
140 rem     Many thanks to Randy W. Sims mailto:RandyS@ThePierianSpring.org.
141 rem     See Randy's response to "RE: [Mingw-msys] Installation on WindowsME" 
142 rem     from 11/06/2002 in the archives of mingw-msys@lists.sf.net.
143 rem
144 rem 2002.11.19  Paul Garceau  mailto:pgarceau@attbi.com
145 rem     * Fix a typo: Change COMPSPEC to COMSPEC.
146 rem
147 rem 2002.11.25  Earnie Boyd  mailto:earnie@users.sf.net
148 rem     * Remove the SET CYGWIN since it doesn't matter any longer.
149 rem
150 rem 2003.02.03  Earnie Boyd  mailto:earnie@users.sf.net
151 rem     * Win9x doesn't like ``EXISTS dir'' so change it to ``EXISTS dir\nul''.
152 rem     Thanks to Nicolas Weber mailto:nicolasweber@gmx.de.
153 rem
154 rem 2003.03.06  Earnie Boyd  mailto:earnie@users.sf.net
155 rem     * Add -backspacekey switch to rxvt startup.
156 rem     * Move RXVT color setup to startrxvt label
157 rem
158 rem 2004.01.30  Earnie Boyd  mailto:earnie@users.sf.net
159 rem     * Add -geometry parameter to work around an off by one issue with
160 rem       the default values.
161 rem     Thanks to Dave Schuyler mailto:parameter@users.sf.net
162 rem
163 rem 2004.03.28  Earnie Boyd  mailto:earnie@users.sf.net
164 rem     * Add -norxvt or --norxvt switch argument.
165 rem     Thanks to Keith Marshall mailto:Keith.Marshall@total.com.
166 rem     * Add method to determine absolute path of msys.bat so that we no
167 rem     longer need to change to the bin directory.  This allows msys.bat to be
168 rem     called from any working directory.
169 rem     Thanks to Kevin Mack  mailto:kevin.mack@us.cd-adapco.com
170 rem
171 rem 2005.07.06  Max TE Woodbury  mailto:mtew@users.sf.net
172 rem     * Fixed WD check for command.com systems.
173 rem     * Minimized intermediate CMD window to reduce startup flashyness.
174 rem     * If rxvt.exe cannot be found, try sh.exe.
175 rem
176 rem 2005.12.06  Tuomo Latto  mailto:nonperson@users.sf.net
177 rem     * Added a temporary workaround for getting MSYS shell to run on x64.
178 rem
179 rem 2005.12.07  Keith Marshall  mailto:keithmarshall@users.sf.net
180 rem     * ``EXISTS %WD%\sh.exe'' should be ``EXISTS %WD%sh.exe''; corrected.
181 rem     * Modified Tuomo's patch, to avoid trashing Window settings in Win32.
182 rem
183 rem 2005.12.08  Tuomo Latto  mailto:nonperson@users.sf.net
184 rem     * Keith's modified patch fails on x64; start did funny things.
185 rem     Reworked, for correct behaviour on both platforms.
186 rem