[PATCH] Support for building using WSL (Windows Subsystem for Linux) on Windows

Andrew Luo andrewluotechnologies at outlook.com
Tue Dec 11 05:25:54 UTC 2018


Hi,

Yes, I've signed an OCA (I've also contributed changes to other groups before, but not build).

Okay, I have fixed the autconf-config* files.

Unfortunately, as Erik mentioned, there is no (supported/reliable) way to access the WSL root / from /cygdrive/c, or even from Windows (there is a way in reality, however, it's not documented/supported by Microsoft and the location changes depending on the distribution/store app id/etc. so best to avoid using it.)  I can see if we can print information about versions however.

Right, WSL requires the .exe extension when accessing an executable, as this is Linux behavior (Linux doesn't have extensions for executables generally, but that's besides the point)...

I fixed BASIC_REMOVE_SYMBOLIC_LINKS - a leftover from another approach I tried.

For the redirect, redirect doesn't seem to be working when you have a bash shell input piped into a Win32 executable reading from stdin using WINAPI.  I'm not sure this is supported by the OpenJDK, more likely it might be a Microsoft issue.  For some reason, the stdin would be cut off (or I would see an exception thrown from available0 in FileInputStream).  I personally didn't see any harm in changing piping into input/output files (since all the inputs/outputs are files anyways!).

I fixed TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE - this was also from a few things I had tried earlier.

I disabled the $BASH code because to call bash from Win32 the correct way is either "wsl /bin/bash" or just "bash".  $BASH correctly evaluates to /bin/bash, however BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH is implemented in terms of wslpath, which can only convert a path under /mnt/c back to a Windows path.  Other files under /, for example /bin and /bin/bash, cannot be converted to a Windwos path.

The escaping changes I made because it wasn't working.  This does work with spaces in the path on WSL.  I don't have a Cygwin environment to check, perhaps someone else here could help out?  Otherwise I can refactor that code to use that echo statement for WSL and use the old echo statement for Cygwin.

I have fixed the extraneous debug print statement.

As for Windows vs Linux output - you can still force it to build a Linux output binary.  You just need to run configure as follows:

./configure --with-boot-jdk=/home/andrew/jdk-11.0.1 ----build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu

However, there is a behavior change: now, on WSL, by default, Windows binaries are targeted.  Previously, Linux binaries were the default target.  (Also, you can run configure twice and two sets of configurations will be generated, you can actually build both images by setting CONF=linux-x86_64-server-release or CONF=windows-x86_64-server-release)

As for BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN, wslpath does not support 8.3 names.  But perhaps the symlink workaround is acceptable for now and we can handle the 8.3 naming on WSL in a separate change, what do you guys think - personally I think what we have (assuming Cygwin still works) is at least a MVP for WSL devs.  Anyways, at least some people may have to use the symlink workaround if they've disabled 8.3 on NTFS.

Attaching my latest patch (generated using powershell, so to properly import you may need to convert UTF16 -> UTF8 and change CRLF to just LF, hg tends to be picky)...

Thanks,

-Andrew


-----Original Message-----
From: Erik Joelsson <erik.joelsson at oracle.com> 
Sent: Monday, December 10, 2018 9:19 AM
To: Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com>; Andrew Luo <andrewluotechnologies at outlook.com>; build-dev at openjdk.java.net
Subject: Re: [PATCH] Support for building using WSL (Windows Subsystem for Linux) on Windows

Hello,

On 2018-12-10 02:06, Magnus Ihse Bursie wrote:
>
> On 2018-12-09 20:11, Andrew Luo wrote:
>>
>> One important thing to note is that the WSL build targets Windows. It 
>> is also possible to use WSL to target itself (a WSL Linux binary) or 
>> even other distributions of Linux.  I have not implemented that yet, 
>> but I think I could do that as a next step if you guys think it would 
>> be useful (at least I think it would be useful, then you can test 
>> your changes for both Windows and Linux on one system...).
> I think if you just run configure ordinarily, it will behave like a 
> Linux system and build the Linux image right out-of-the-box..? But 
> then again, maybe that behavior is negated by your changes to 
> config.guess and platform.m4. So maybe we need a flag to configure to 
> control this...

It is indeed possible to build a pure Linux binary in WSL today so I think it would be bad to lose that functionality. We certainly need a configure flag to control if a Windows or Linux build should be produced in this case. This is something I have been thinking about when I started tackling WSL builds some time ago but didn't really come up with a good solution. I didn't have the time to spend to really see it through though, so it's nice to see that someone else is trying.

We could simply use the --with-openjdk-target, that would perhaps be the cleanest, but it's also a bit cumbersome. We may need some simplification similar to how we have --with-target-bits=32/64 as a simple switch (e.g. --with-wsl-target=linux/windows?).

>>
>> Steps in case you want to try this out:
>>
>>
>> 1.       Due to autotools not handling spaces well, you have to 
>> create symlinks in Windows that will allow you to access Windows Kits 
>> and the VC++ compiler without spaces in the path:
>>
>> mklink /D C:\VS "C:\Program Files (x86)\Microsoft Visual Studio"
>>
>> mklink /D C:\WindowsKits "C:\Program Files (x86)\Windows Kits"
> That's a bit odd. We encounter spaces in paths on Windows normally on 
> cygwin and msys, and that works fine. I suspect there is something 
> missing with the rewriting functions. What we do, is that we rewrite 
> paths with spaces to paths without spaces, by using the old 8+3 
> compatibility names, so we get something like 
> "/cygdrive/c/progra~1/microso~2" from "C:\Program Files 
> (x86)\Microsoft Visual Studio". Have a look at 
> BASIC_MAKE_WINDOWS_SPACE_SAFE_CYGWIN. I think you need a WSL version 
> of that, as well as of BASIC_FIXUP_PATH_CYGWIN. (And you need to call 
> the BASIC_FIXUP_PATH_WSL from BASIC_FIXUP_PATH.)
>
> If you get these parts right, I don't think you will need any of the 
> special instructions below to build. In fact, as long as C:\... is 
> properly remapped, the normal VS autodetect code should work just 
> fine. And perhaps you can even revert some of the scarier changes in 
> toolchain_windows.m4.
>
I definitely agree with Magnus that to make WSL truly supported, the 
path handling macros need to be replicated. I'm not sure how to solve it 
properly. The root path Magnus is asking for is not defined in WSL. In 
fact, from windows you cannot reach any path in the WSL filesystem. Only 
Windows drives are mounted in WSL, not the other way around. To convert 
to old style paths in Cygwin we rely on the cygpath utility. There is a 
wslpath utility but does it support old style path conversions? If not, 
maybe it's possible to write such a tool in CMD/PowerShell?

/Erik


>> 2.       wsl must be started from a Windows Developer command 
>> prompt.  To ensure the correct environment variables are propagated 
>> from Windows to WSL, you can run the following commands:
>>
>> set WSLENV=INCLUDE/l:LIBPATH/l
>>
>> 3.       Start wsl (bash):
>>
>> wsl
>>
>> 4.       After starting bash you must set your compiler variables to 
>> explicitly point to the correct tools:
>>
>> export 
>> AR=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/lib.exe
>>
>> export 
>> CC=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
>>
>> export 
>> CXX=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
>>
>> export 
>> LD=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/link.exe
>>
>> export RC=/mnt/c/WindowsKits/10/bin/10.0.17763.0/x64/rc.exe
>>
>> export MT=/mnt/c/WindowsKits/10/bin/10.0.17763.0/x64/mt.exe
>>
>> export 
>> DUMPBIN=/mnt/c/VS/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/dumpbin.exe
>>
>> 5.       Run configure:
>>
>> ./configure 
>> --with-boot-jdk=/mnt/c/Users/Andrew/Downloads/openjdk-11.0.1_windows-x64_bin/jdk-11.0.1 
>> --with-tools-dir="C:\VS\2017\Enterprise\VC\Auxiliary" 
>> --with-ucrt-dll-dir="/mnt/c/WindowsKits/10/Redist/ucrt/DLLs/x64"
>>
>> 6.       Run make
>>
>> I've tested make with the default target as well as "make images"
>>
>> Let me know if you have any feedback/comments.
>>
>> Thanks,
>>
>> -Andrew
>>
>
-------------- next part --------------
ÿþd i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / I m a g e s . g m k 
 
 - - -   a / m a k e / I m a g e s . g m k 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / I m a g e s . g m k 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 9 9 , 7   + 9 9 , 7   @ @ 
 
   	 ) 
 
                   i f e q   ( $ ( B U I L D _ C D S _ A R C H I V E ) ,   t r u e ) 
 
   	     $ ( c a l l   L o g W a r n ,   C r e a t i n g   C D S   a r c h i v e   f o r   j d k   i m a g e ) 
 
 - 	     $ ( J D K _ I M A G E _ D I R ) / b i n / j a v a   - X s h a r e : d u m p   - X m x 1 2 8 M   - X m s 1 2 8 M   $ ( L O G _ I N F O ) 
 
 + 	     $ ( J D K _ I M A G E _ D I R ) / b i n / j a v a $ ( E X E _ S U F F I X )   - X s h a r e : d u m p   - X m x 1 2 8 M   - X m s 1 2 8 M   $ ( L O G _ I N F O ) 
 
                   e n d i f 
 
   	 $ ( T O U C H )   $ @ 
 
   
 
 @ @   - 1 1 4 , 7   + 1 1 4 , 7   @ @ 
 
   	 ) 
 
                   i f e q   ( $ ( B U I L D _ C D S _ A R C H I V E ) ,   t r u e ) 
 
   	     $ ( c a l l   L o g W a r n ,   C r e a t i n g   C D S   a r c h i v e   f o r   j r e   i m a g e ) 
 
 - 	     $ ( J R E _ I M A G E _ D I R ) / b i n / j a v a   - X s h a r e : d u m p   - X m x 1 2 8 M   - X m s 1 2 8 M   $ ( L O G _ I N F O ) 
 
 + 	     $ ( J R E _ I M A G E _ D I R ) / b i n / j a v a $ ( E X E _ S U F F I X )   - X s h a r e : d u m p   - X m x 1 2 8 M   - X m s 1 2 8 M   $ ( L O G _ I N F O ) 
 
                   e n d i f 
 
   	 $ ( T O U C H )   $ @ 
 
   
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / b a s i c s . m 4 
 
 - - -   a / m a k e / a u t o c o n f / b a s i c s . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / b a s i c s . m 4 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 6 0 7 , 6   + 6 0 7 , 7   @ @ 
 
   
 
       #   T h e s e   a r e   n o t   r e q u i r e d   o n   a l l   p l a t f o r m s 
 
       B A S I C _ P A T H _ P R O G S ( C Y G P A T H ,   c y g p a t h ) 
 
 +     B A S I C _ P A T H _ P R O G S ( W S L P A T H ,   w s l p a t h ) 
 
       B A S I C _ P A T H _ P R O G S ( D F ,   d f ) 
 
       B A S I C _ P A T H _ P R O G S ( C P I O ,   [ c p i o   b s d c p i o ] ) 
 
       B A S I C _ P A T H _ P R O G S ( N I C E ,   n i c e ) 
 
 @ @   - 6 3 4 , 8   + 6 3 5 , 1 0   @ @ 
 
           B A S I C _ C H E C K _ P A T H S _ W I N D O W S 
 
       e l s e 
 
           P A T H _ S E P = " : " 
 
 + 	 E X E C U T A B L E _ S U F F I X = " " 
 
       f i 
 
       A C _ S U B S T ( P A T H _ S E P ) 
 
 +     A C _ S U B S T ( E X E C U T A B L E _ S U F F I X ) 
 
   
 
       #   W e   g e t   t h e   t o p - l e v e l   d i r e c t o r y   f r o m   t h e   s u p p o r t i n g   w r a p p e r s . 
 
       A C _ M S G _ C H E C K I N G ( [ f o r   t o p - l e v e l   d i r e c t o r y ] ) 
 
 @ @   - 9 8 0 , 6   + 9 8 3 , 8   @ @ 
 
                           M A K E _ E X P E C T E D _ E N V = ' c y g w i n ' 
 
                       e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . m s y s " ;   t h e n 
 
                           M A K E _ E X P E C T E D _ E N V = ' m s y s ' 
 
 +                     e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +                         M A K E _ E X P E C T E D _ E N V = ' x 8 6 _ 6 4 - p c - l i n u x - g n u ' 
 
                       e l s e 
 
                           A C _ M S G _ E R R O R ( [ U n k n o w n   W i n d o w s   e n v i r o n m e n t ] ) 
 
                       f i 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / b a s i c s _ w i n d o w s . m 4 
 
 - - -   a / m a k e / a u t o c o n f / b a s i c s _ w i n d o w s . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / b a s i c s _ w i n d o w s . m 4 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 3 2 , 6   + 3 2 , 9   @ @ 
 
       e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . m s y s " ;   t h e n 
 
           u n i x _ p a t h = ` $ E C H O   " $ w i n d o w s _ p a t h "   |   $ S E D   - e   ' s , ^ \ \ ( . \ \ ) : , / \ \ 1 , g '   - e   ' s , \ \ \ \ , / , g ' ` 
 
           $ 1 = " $ u n i x _ p a t h " 
 
 +     e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +         u n i x _ p a t h = ` $ W S L P A T H   - u   " $ w i n d o w s _ p a t h " ` 
 
 +         $ 1 = " $ u n i x _ p a t h " 
 
       f i 
 
   ] ) 
 
   
 
 @ @   - 4 4 , 6   + 4 7 , 9   @ @ 
 
       e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . m s y s " ;   t h e n 
 
           w i n d o w s _ p a t h = ` c m d   / / c   e c h o   $ u n i x _ p a t h ` 
 
           $ 1 = " $ w i n d o w s _ p a t h " 
 
 +     e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +         w i n d o w s _ p a t h = ` $ W S L P A T H   - m   " $ u n i x _ p a t h " ` 
 
 +         $ 1 = " $ w i n d o w s _ p a t h " 
 
       f i 
 
   ] ) 
 
   
 
 @ @   - 3 3 9 , 6   + 3 4 5 , 7   @ @ 
 
           i f   t e s t   " x $ t e s t _ c y g d r i v e _ p r e f i x "   =   x ;   t h e n 
 
               A C _ M S G _ E R R O R ( [ Y o u r   c y g d r i v e   p r e f i x   i s   n o t   / c y g d r i v e .   T h i s   i s   c u r r e n t l y   n o t   s u p p o r t e d .   C h a n g e   w i t h   m o u n t   - c . ] ) 
 
           f i 
 
 + 	 E X E C U T A B L E _ S U F F I X = " " 
 
       e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . m s y s " ;   t h e n 
 
           A C _ M S G _ C H E C K I N G ( [ m s y s   r e l e a s e ] ) 
 
           M S Y S _ V E R S I O N = ` $ U N A M E   - r ` 
 
 @ @   - 3 5 3 , 8   + 3 6 0 , 1 1   @ @ 
 
           B A S I C _ W I N D O W S _ R E W R I T E _ A S _ U N I X _ P A T H ( M S Y S _ R O O T _ P A T H ) 
 
           A C _ M S G _ R E S U L T ( [ $ M S Y S _ R O O T _ P A T H ] ) 
 
           W I N D O W S _ E N V _ R O O T _ P A T H = " $ M S Y S _ R O O T _ P A T H " 
 
 + 	 E X E C U T A B L E _ S U F F I X = " " 
 
 +     e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 + 	 E X E C U T A B L E _ S U F F I X = " . e x e " 
 
       e l s e 
 
 -         A C _ M S G _ E R R O R ( [ U n k n o w n   W i n d o w s   e n v i r o n m e n t .   N e i t h e r   c y g w i n   n o r   m s y s   w a s   d e t e c t e d . ] ) 
 
 +         A C _ M S G _ E R R O R ( [ U n k n o w n   W i n d o w s   e n v i r o n m e n t .   N e i t h e r   c y g w i n ,   m s y s ,   n o r   w s l   w a s   d e t e c t e d . ] ) 
 
       f i 
 
   
 
       #   T e s t   i f   w i n d o w s   o r   u n i x   ( c y g w i n / m s y s )   f i n d   i s   f i r s t   i n   p a t h . 
 
 @ @   - 3 9 5 , 6   + 4 0 5 , 8   @ @ 
 
                       |   t r   '   '   ' \ n '   |   $ G R E P   ' ^ / . / '   |   $ S O R T   |   $ U N I Q ` 
 
               f i x p a t h _ a r g u m e n t _ l i s t = ` e c h o   $ a l l _ u n i q u e _ p r e f i x e s     |   t r   '   '   ' @ ' ` 
 
               F I X P A T H = " $ F I X P A T H _ B I N   - m $ f i x p a t h _ a r g u m e n t _ l i s t " 
 
 + 	 e l i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   x w i n d o w s . w s l ;   t h e n 
 
 +             F I X P A T H = " $ F I X P A T H _ B I N   - w " 
 
           f i 
 
           F I X P A T H _ S R C _ W = " $ F I X P A T H _ S R C " 
 
           F I X P A T H _ B I N _ W = " $ F I X P A T H _ B I N " 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / b o o t - j d k . m 4 
 
 - - -   a / m a k e / a u t o c o n f / b o o t - j d k . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / b o o t - j d k . m 4 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 6 3 , 1 8   + 6 3 , 1 8   @ @ 
 
           #   I f   p r e v i o u s   s t e p   c l a i m e d   t o   h a v e   f o u n d   a   J D K ,   c h e c k   i t   t o   s e e   i f   i t   s e e m s   t o   b e   v a l i d . 
 
           i f   t e s t   " x $ B O O T _ J D K _ F O U N D "   =   x m a y b e ;   t h e n 
 
               #   D o   w e   h a v e   a   b i n / j a v a ? 
 
 -             i f   t e s t   !   - x   " $ B O O T _ J D K / b i n / j a v a " ;   t h e n 
 
 +             i f   t e s t   !   - x   " $ B O O T _ J D K / b i n / j a v a $ E X E C U T A B L E _ S U F F I X " ;   t h e n 
 
                   A C _ M S G _ N O T I C E ( [ P o t e n t i a l   B o o t   J D K   f o u n d   a t   $ B O O T _ J D K   d i d   n o t   c o n t a i n   b i n / j a v a ;   i g n o r i n g ] ) 
 
                   B O O T _ J D K _ F O U N D = n o 
 
               e l s e 
 
                   #   D o   w e   h a v e   a   b i n / j a v a c ? 
 
 -                 i f   t e s t   !   - x   " $ B O O T _ J D K / b i n / j a v a c " ;   t h e n 
 
 +                 i f   t e s t   !   - x   " $ B O O T _ J D K / b i n / j a v a c $ E X E C U T A B L E _ S U F F I X " ;   t h e n 
 
                       A C _ M S G _ N O T I C E ( [ P o t e n t i a l   B o o t   J D K   f o u n d   a t   $ B O O T _ J D K   d i d   n o t   c o n t a i n   b i n / j a v a c ;   i g n o r i n g ] ) 
 
                       A C _ M S G _ N O T I C E ( [ ( T h i s   m i g h t   b e   a n   J R E   i n s t e a d   o f   a n   J D K ) ] ) 
 
                       B O O T _ J D K _ F O U N D = n o 
 
                   e l s e 
 
                       #   O h ,   t h i s   i s   l o o k i n g   g o o d !   W e   p r o b a b l y   h a v e   f o u n d   a   p r o p e r   J D K .   I s   i t   t h e   c o r r e c t   v e r s i o n ? 
 
 -                     B O O T _ J D K _ V E R S I O N = ` " $ B O O T _ J D K / b i n / j a v a "   $ U S E R _ B O O T _ J D K _ O P T I O N S   - v e r s i o n   2 > & 1   |   $ H E A D   - n   1 ` 
 
 +                     B O O T _ J D K _ V E R S I O N = ` " $ B O O T _ J D K / b i n / j a v a $ E X E C U T A B L E _ S U F F I X "   $ U S E R _ B O O T _ J D K _ O P T I O N S   - v e r s i o n   2 > & 1   |   $ H E A D   - n   1 ` 
 
                       i f   [   [ [   " $ B O O T _ J D K _ V E R S I O N "   = ~   " P i c k e d   u p "   ] ]   ] ;   t h e n 
 
                           A C _ M S G _ N O T I C E ( [ Y o u   h a v e   _ J A V A _ O P T I O N S   o r   J A V A _ T O O L _ O P T I O N S   s e t .   T h i s   c a n   m e s s   u p   t h e   b u i l d .   P l e a s e   u s e   - - w i t h - b o o t - j d k - j v m a r g s   i n s t e a d . ] ) 
 
                           A C _ M S G _ N O T I C E ( [ J a v a   r e p o r t s :   " $ B O O T _ J D K _ V E R S I O N " . ] ) 
 
 @ @   - 1 0 1 , 7   + 1 0 1 , 7   @ @ 
 
                           A C _ M S G _ C H E C K I N G ( [ f o r   B o o t   J D K ] ) 
 
                           A C _ M S G _ R E S U L T ( [ $ B O O T _ J D K ] ) 
 
                           A C _ M S G _ C H E C K I N G ( [ B o o t   J D K   v e r s i o n ] ) 
 
 -                         B O O T _ J D K _ V E R S I O N = ` " $ B O O T _ J D K / b i n / j a v a "   $ U S E R _ B O O T _ J D K _ O P T I O N S   - v e r s i o n   2 > & 1   |   $ T R   ' \ n \ r '   '     ' ` 
 
 +                         B O O T _ J D K _ V E R S I O N = ` " $ B O O T _ J D K / b i n / j a v a $ E X E C U T A B L E _ S U F F I X "   $ U S E R _ B O O T _ J D K _ O P T I O N S   - v e r s i o n   2 > & 1   |   $ T R   ' \ n \ r '   '     ' ` 
 
                           A C _ M S G _ R E S U L T ( [ $ B O O T _ J D K _ V E R S I O N ] ) 
 
                       f i   #   e n d   c h e c k   j d k   v e r s i o n 
 
                   f i   #   e n d   c h e c k   j a v a c 
 
 @ @   - 3 3 5 , 1 1   + 3 3 5 , 1 1   @ @ 
 
       A C _ S U B S T ( B O O T _ J D K ) 
 
   
 
       #   S e t u p   t o o l s   f r o m   t h e   B o o t   J D K . 
 
 -     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A ,   j a v a ) 
 
 -     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A C ,   j a v a c ) 
 
 -     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A D O C ,   j a v a d o c ) 
 
 -     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A R ,   j a r ) 
 
 -     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A R S I G N E R ,   j a r s i g n e r ) 
 
 +     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A ,   j a v a $ E X E C U T A B L E _ S U F F I X ) 
 
 +     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A C ,   j a v a c $ E X E C U T A B L E _ S U F F I X ) 
 
 +     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A V A D O C ,   j a v a d o c $ E X E C U T A B L E _ S U F F I X ) 
 
 +     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A R ,   j a r $ E X E C U T A B L E _ S U F F I X ) 
 
 +     B O O T J D K _ C H E C K _ T O O L _ I N _ B O O T J D K ( J A R S I G N E R ,   j a r s i g n e r $ E X E C U T A B L E _ S U F F I X ) 
 
   
 
       #   F i n a l l y ,   s e t   s o m e   o t h e r   o p t i o n s . . . 
 
   
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . g u e s s 
 
 - - -   a / m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . g u e s s 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . g u e s s 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 6 0 , 6   + 6 0 , 1 5   @ @ 
 
       e s a c 
 
   f i 
 
   
 
 + #   T e s t   a n d   f i x   w s l 
 
 + e c h o   $ O U T   |   g r e p   x 8 6 _ 6 4 - u n k n o w n - l i n u x - g n u   >   / d e v / n u l l   2 >   / d e v / n u l l 
 
 + i f   t e s t   $ ?   =   0 ;   t h e n 
 
 +     u n a m e   - r   |   g r e p   M i c r o s o f t   >   / d e v / n u l l   2 >   / d e v / n u l l 
 
 +     i f   t e s t   $ ?   =   0 ;   t h e n 
 
 +         O U T = " x 8 6 _ 6 4 - p c - w s l " 
 
 +     f i 
 
 + f i 
 
 + 
 
   #   T e s t   a n d   f i x   a r c h i t e c t u r e   s t r i n g   o n   A I X 
 
   #   O n   A I X   ' c o n f i g . g u e s s '   r e t u r n s   ' p o w e r p c '   a s   a r c h i t e c t u r e   b u t   ' p o w e r p c '   i s 
 
   #   i m p l i c i t e l y   h a n d l e d   a s   3 2 - b i t   a r c h i t e c t u r e   i n   ' p l a t f o r m . m 4 '   s o   w e   c h e c k 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . s u b 
 
 - - -   a / m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . s u b 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / b u i l d - a u x / c o n f i g . s u b 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 9 , 7   + 2 9 , 1 3   @ @ 
 
   
 
   D I R = ` d i r n a m e   $ 0 ` 
 
   
 
 - #   F i r s t ,   f i l t e r   o u t   e v e r y t h i n g   t h a t   d o e s n ' t   b e g i n   w i t h   " a a r c h 6 4 - " 
 
 + #   A l l o w   w s l 
 
 + i f   e c h o   $ *   |   g r e p   x 8 6 _ 6 4 - p c - w s l   > / d e v / n u l l   ;   t h e n 
 
 +         e c h o   $ * 
 
 +         e x i t 
 
 + f i 
 
 + 
 
 + #   F i l t e r   o u t   e v e r y t h i n g   t h a t   d o e s n ' t   b e g i n   w i t h   " a a r c h 6 4 - " 
 
   i f   !   e c h o   $ *   |   g r e p   ' ^ a a r c h 6 4 - '   > / d e v / n u l l   ;   t h e n 
 
           .   $ D I R / a u t o c o n f - c o n f i g . s u b   " $ @ " 
 
           #   a u t o c o n f - c o n f i g . s u b   e x i t s ,   s o   w e   n e v e r   r e a c h   h e r e ,   b u t   j u s t   i n 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / p l a t f o r m . m 4 
 
 - - -   a / m a k e / a u t o c o n f / p l a t f o r m . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / p l a t f o r m . m 4 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 1 8 8 , 6   + 1 8 8 , 1 0   @ @ 
 
               V A R _ O S = w i n d o w s 
 
               V A R _ O S _ E N V = w i n d o w s . c y g w i n 
 
               ; ; 
 
 +         * w s l * ) 
 
 +             V A R _ O S = w i n d o w s 
 
 +             V A R _ O S _ E N V = w i n d o w s . w s l 
 
 +             ; ; 
 
           * m i n g w * ) 
 
               V A R _ O S = w i n d o w s 
 
               V A R _ O S _ E N V = w i n d o w s . m s y s 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / t o o l c h a i n . m 4 
 
 - - -   a / m a k e / a u t o c o n f / t o o l c h a i n . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / t o o l c h a i n . m 4 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 8 1 , 1 3   + 2 8 1 , 1 3   @ @ 
 
   
 
       T O O L C H A I N _ C C _ B I N A R Y _ c l a n g = " c l a n g " 
 
       T O O L C H A I N _ C C _ B I N A R Y _ g c c = " g c c " 
 
 -     T O O L C H A I N _ C C _ B I N A R Y _ m i c r o s o f t = " c l " 
 
 +     T O O L C H A I N _ C C _ B I N A R Y _ m i c r o s o f t = " c l $ E X E C U T A B L E _ S U F F I X " 
 
       T O O L C H A I N _ C C _ B I N A R Y _ s o l s t u d i o = " c c " 
 
       T O O L C H A I N _ C C _ B I N A R Y _ x l c = " x l c _ r " 
 
   
 
       T O O L C H A I N _ C X X _ B I N A R Y _ c l a n g = " c l a n g + + " 
 
       T O O L C H A I N _ C X X _ B I N A R Y _ g c c = " g + + " 
 
 -     T O O L C H A I N _ C X X _ B I N A R Y _ m i c r o s o f t = " c l " 
 
 +     T O O L C H A I N _ C X X _ B I N A R Y _ m i c r o s o f t = " c l $ E X E C U T A B L E _ S U F F I X " 
 
       T O O L C H A I N _ C X X _ B I N A R Y _ s o l s t u d i o = " C C " 
 
       T O O L C H A I N _ C X X _ B I N A R Y _ x l c = " x l C _ r " 
 
   
 
 @ @   - 4 3 0 , 7   + 4 3 0 , 7   @ @ 
 
           #   T h e r e   i s   n o   s p e c i f i c   v e r s i o n   f l a g ,   b u t   a l l   o u t p u t   s t a r t s   w i t h   a   v e r s i o n   s t r i n g . 
 
           #   F i r s t   l i n e   t y p i c a l l y   l o o k s   s o m e t h i n g   l i k e : 
 
           #   M i c r o s o f t   ( R )   3 2 - b i t   C / C + +   O p t i m i z i n g   C o m p i l e r   V e r s i o n   1 6 . 0 0 . 4 0 2 1 9 . 0 1   f o r   8 0 x 8 6 
 
 -         C O M P I L E R _ V E R S I O N _ O U T P U T = ` $ C O M P I L E R   2 > & 1   |   $ H E A D   - n   1   |   $ T R   - d   ' \ r ' ` 
 
 +         C O M P I L E R _ V E R S I O N _ O U T P U T = ` " $ C O M P I L E R "   2 > & 1   |   $ H E A D   - n   1   |   $ T R   - d   ' \ r ' ` 
 
           #   C h e c k   t h a t   t h i s   i s   l i k e l y   t o   b e   M i c r o s o f t   C L . E X E . 
 
           $ E C H O   " $ C O M P I L E R _ V E R S I O N _ O U T P U T "   |   $ G R E P   " M i c r o s o f t . * C o m p i l e r "   >   / d e v / n u l l 
 
           i f   t e s t   $ ?   - n e   0 ;   t h e n 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / a u t o c o n f / t o o l c h a i n _ w i n d o w s . m 4 
 
 - - -   a / m a k e / a u t o c o n f / t o o l c h a i n _ w i n d o w s . m 4 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / a u t o c o n f / t o o l c h a i n _ w i n d o w s . m 4 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 1 1 5 , 7   + 1 1 5 , 7   @ @ 
 
                   V C V A R S F I L E S = " v c / b i n / v c v a r s 3 2 . b a t   v c / a u x i l i a r y / b u i l d / v c v a r s 3 2 . b a t " 
 
               e l s e 
 
                   V C V A R S F I L E S = " v c / b i n / a m d 6 4 / v c v a r s 6 4 . b a t   v c / b i n / x 8 6 _ a m d 6 4 / v c v a r s x 8 6 _ a m d 6 4 . b a t   \ 
 
 -                         v c / a u x i l i a r y / b u i l d / v c v a r s x 8 6 _ a m d 6 4 . b a t   v c / a u x i l i a r y / b u i l d / v c v a r s 6 4 . b a t " 
 
 +                         V C / A u x i l i a r y / B u i l d / v c v a r s x 8 6 _ a m d 6 4 . b a t   V C / A u x i l i a r y / B u i l d / v c v a r s 6 4 . b a t " 
 
               f i 
 
   
 
               f o r   V C V A R S F I L E   i n   $ V C V A R S F I L E S ;   d o 
 
 @ @   - 2 2 2 , 7   + 2 2 2 , 6   @ @ 
 
               [ C : / P r o g r a m   F i l e s / $ V S _ I N S T A L L _ D I R ] ,   [ w e l l - k n o w n   n a m e ] ) 
 
       T O O L C H A I N _ C H E C K _ P O S S I B L E _ V I S U A L _ S T U D I O _ R O O T ( [ $ { V S _ V E R S I O N } ] , 
 
               [ C : / P r o g r a m   F i l e s   ( x 8 6 ) / $ V S _ I N S T A L L _ D I R ] ,   [ w e l l - k n o w n   n a m e ] ) 
 
 - 
 
       i f   t e s t   " x $ S D K _ I N S T A L L _ D I R "   ! =   x ;   t h e n 
 
           i f   t e s t   " x $ P r o g r a m W 6 4 3 2 "   ! =   x ;   t h e n 
 
               T O O L C H A I N _ C H E C K _ P O S S I B L E _ W I N _ S D K _ R O O T ( [ $ { V S _ V E R S I O N } ] , 
 
 @ @   - 3 7 2 , 8   + 3 7 1 , 1 3   @ @ 
 
               #   I n s t e a d   c r e a t e   a   s h e l l   s c r i p t   w h i c h   w i l l   s e t   t h e   r e l e v a n t   v a r i a b l e s   w h e n   r u n . 
 
               W I N P A T H _ V S _ E N V _ C M D = " $ V S _ E N V _ C M D " 
 
               B A S I C _ W I N D O W S _ R E W R I T E _ A S _ W I N D O W S _ M I X E D _ P A T H ( [ W I N P A T H _ V S _ E N V _ C M D ] ) 
 
 -             W I N P A T H _ B A S H = " $ B A S H " 
 
 -             B A S I C _ W I N D O W S _ R E W R I T E _ A S _ W I N D O W S _ M I X E D _ P A T H ( [ W I N P A T H _ B A S H ] ) 
 
 + 	     
 
 +             i f   t e s t   " x $ O P E N J D K _ B U I L D _ O S _ E N V "   =   " x w i n d o w s . w s l " ;   t h e n 
 
 +                 W I N P A T H _ B A S H = " b a s h " 
 
 +             e l s e 
 
 +                 W I N P A T H _ B A S H = " $ B A S H " 
 
 +                 B A S I C _ W I N D O W S _ R E W R I T E _ A S _ W I N D O W S _ M I X E D _ P A T H ( [ W I N P A T H _ B A S H ] ) 
 
 +             f i 
 
   
 
               #   G e n e r a t e   a   D O S   b a t c h   f i l e   w h i c h   r u n s   $ V S _ E N V _ C M D ,   a n d   t h e n   c r e a t e s   a   s h e l l 
 
               #   s c r i p t   ( e x e c u t a b l e   b y   b a s h )   t h a t   w i l l   s e t u p   t h e   i m p o r t a n t   v a r i a b l e s . 
 
 @ @   - 3 8 1 , 7   + 3 8 5 , 7   @ @ 
 
               $ E C H O   " @ e c h o   o f f "   >     $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
               #   T h i s   w i l l   e n d   u p   s o m e t h i n g   l i k e : 
 
               #   c a l l   C : / p r o g r a ~ 2 / m i c r o s ~ 2 . 0 / v c / b i n / a m d 6 4 / v c v a r s 6 4 . b a t 
 
 -             $ E C H O   " c a l l   $ W I N P A T H _ V S _ E N V _ C M D   $ V S _ E N V _ A R G S "   > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 +             $ E C H O   " c a l l   \ " $ W I N P A T H _ V S _ E N V _ C M D \ "   $ V S _ E N V _ A R G S "   > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
               #   I n   s o m e   c a s e s ,   t h e   V S _ E N V _ C M D   w i l l   c h a n g e   d i r e c t o r y ,   c h a n g e   b a c k   s o 
 
               #   t h e   s e t - v s - e n v . s h   e n d s   u p   i n   t h e   r i g h t   p l a c e . 
 
               $ E C H O   ' c d   % ~ d p 0 '   > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 @ @   - 3 8 9 , 2 8   + 3 9 3 , 2 8   @ @ 
 
               #   C : / C y g W i n / b i n / b a s h   - c   ' e c h o   V S _ P A T H = \ " $ P A T H \ "   >   l o c a l d e v e n v . s h 
 
               #   T h e   t r a i l i n g   s p a c e   f o r   e v e r y o n e   e x c e p t   P A T H   i s   n o   t y p o ,   b u t   i s   n e e d e d   d u e 
 
               #   t o   t r a i l i n g   \   i n   t h e   W i n d o w s   p a t h s .   T h e s e   w i l l   b e   s t r i p p e d   l a t e r . 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   V S _ P A T H = " ' \ " $ P A T H \ "   >   s e t - v s - e n v . s h '   \ 
 
 +             $ E C H O   " $ W I N P A T H _ B A S H " '   - c   " e c h o   V S _ P A T H = \ \ \ " \ " $ P A T H \ " \ \ \ "   >   s e t - v s - e n v . s h " '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   V S _ I N C L U D E = " ' \ " $ I N C L U D E \ ; $ i n c l u d e   \ "   > >   s e t - v s - e n v . s h '   \ 
 
 +             $ E C H O   " $ W I N P A T H _ B A S H " '   - c   " e c h o   V S _ I N C L U D E = \ \ \ " \ " $ I N C L U D E \ ; $ i n c l u d e   \ " \ \ \ "   > >   s e t - v s - e n v . s h " '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   V S _ L I B = " ' \ " $ L I B \ ; $ l i b   \ "   > >   s e t - v s - e n v . s h '   \ 
 
 +             $ E C H O   " $ W I N P A T H _ B A S H " '   - c   " e c h o   V S _ L I B = \ \ \ " \ " $ L I B \ ; $ l i b   \ " \ \ \ "   > >   s e t - v s - e n v . s h " '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   V C I N S T A L L D I R = " ' \ " $ V C I N S T A L L D I R   \ "   > >   s e t - v s - e n v . s h '   \ 
 
 +             $ E C H O   " $ W I N P A T H _ B A S H " '   - c   " e c h o   V C I N S T A L L D I R = \ \ \ " \ " $ V C I N S T A L L D I R   \ " \ \ \ "   > >   s e t - v s - e n v . s h " '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   W i n d o w s S d k D i r = " ' \ " $ W i n d o w s S d k D i r   \ "   > >   s e t - v s - e n v . s h '   \ 
 
 +             $ E C H O   " $ W I N P A T H _ B A S H " '   - c   " e c h o   W i n d o w s S d k D i r = \ \ \ " \ " $ W i n d o w s S d k D i r   \ " \ \ \ "   > >   s e t - v s - e n v . s h " '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
 -             $ E C H O   " $ W I N P A T H _ B A S H   - c   ' e c h o   W I N D O W S S D K D I R = " ' \ " $ W I N D O W S S D K D I R   \ "   > >   s e t - v s - e n v . s h '   \ 
 
 +             $ E C H O   " $ W I N P A T H _ B A S H " '   - c   " e c h o   W I N D O W S S D K D I R = \ \ \ " \ " $ W I N D O W S S D K D I R   \ " \ \ \ "   > >   s e t - v s - e n v . s h " '   \ 
 
                       > >   $ E X T R A C T _ V C _ E N V _ B A T _ F I L E 
 
   
 
               #   N o w   e x e c u t e   t h e   n e w l y   c r e a t e d   b a t   f i l e . 
 
               #   T h e   |   c a t   i s   t o   s t o p   S e t E n v . C m d   t o   m e s s   w i t h   s y s t e m   c o l o r s   o n   m s y s . 
 
               #   C h a n g e   d i r e c t o r y   s o   w e   d o n ' t   n e e d   t o   m e s s   w i t h   W i n d o w s   p a t h s   i n   r e d i r e c t s . 
 
               c d   $ V S _ E N V _ T M P _ D I R 
 
 -             c m d   / c   e x t r a c t - v s - e n v . b a t   |   $ C A T 
 
 +             c m d $ E X E C U T A B L E _ S U F F I X   / c   e x t r a c t - v s - e n v . b a t   |   $ C A T 
 
               c d   $ C U R D I R 
 
   
 
               i f   t e s t   !   - s   $ V S _ E N V _ T M P _ D I R / s e t - v s - e n v . s h ;   t h e n 
 
 -                 A C _ M S G _ N O T I C E ( [ C o u l d   n o t   s u c c e s f u l l y   e x t r a c t   t h e   e n v i o n m e n t   v a r i a b l e s   n e e d e d   f o r   t h e   V S   s e t u p . ] ) 
 
 +                 A C _ M S G _ N O T I C E ( [ C o u l d   n o t   s u c c e s f u l l y   e x t r a c t   t h e   e n v i r o n m e n t   v a r i a b l e s   n e e d e d   f o r   t h e   V S   s e t u p . ] ) 
 
                   A C _ M S G _ N O T I C E ( [ T r y   s e t t i n g   - - w i t h - t o o l s - d i r   t o   t h e   V C / b i n   d i r e c t o r y   w i t h i n   t h e   V S   i n s t a l l a t i o n ] ) 
 
                   A C _ M S G _ N O T I C E ( [ o r   r u n   " b a s h . e x e   - l "   f r o m   a   V S   c o m m a n d   p r o m p t   a n d   t h e n   r u n   c o n f i g u r e   f r o m   t h e r e . ] ) 
 
                   A C _ M S G _ E R R O R ( [ C a n n o t   c o n t i n u e ] ) 
 
 @ @   - 6 9 3 , 7   + 6 9 7 , 7   @ @ 
 
       i f   t e s t   " x $ U S E _ U C R T "   =   " x t r u e " ;   t h e n 
 
           A C _ M S G _ C H E C K I N G ( [ f o r   U C R T   D L L   d i r ] ) 
 
           i f   t e s t   " x $ w i t h _ u c r t _ d l l _ d i r "   ! =   x ;   t h e n 
 
 -             i f   t e s t   - z   " $ ( l s   - d   " $ w i t h _ u c r t _ d l l _ d i r / * . d l l "   2 >   / d e v / n u l l ) " ;   t h e n 
 
 +             i f   t e s t   - z   " $ ( l s   - d   $ w i t h _ u c r t _ d l l _ d i r / * . d l l   2 >   / d e v / n u l l ) " ;   t h e n 
 
                   A C _ M S G _ R E S U L T ( [ n o ] ) 
 
                   A C _ M S G _ E R R O R ( [ C o u l d   n o t   f i n d   a n y   d l l s   i n   $ w i t h _ u c r t _ d l l _ d i r ] ) 
 
               e l s e 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / g e n d a t a / G e n d a t a - j a v a . b a s e . g m k 
 
 - - -   a / m a k e / g e n d a t a / G e n d a t a - j a v a . b a s e . g m k 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / g e n d a t a / G e n d a t a - j a v a . b a s e . g m k 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 5 5 , 7   + 5 5 , 7   @ @ 
 
   $ ( G E N D A T A _ C U R D A T A ) :   $ ( T O P D I R ) / m a k e / d a t a / c u r r e n c y / C u r r e n c y D a t a . p r o p e r t i e s   $ ( B U I L D _ T O O L S _ J D K ) 
 
   	 $ ( c a l l   M a k e D i r ,   $ ( @ D ) ) 
 
   	 $ ( R M )   $ @ 
 
 - 	 $ ( T O O L _ G E N E R A T E C U R R E N C Y D A T A )   - o   $ @ . t m p   <   $ < 
 
 + 	 $ ( T O O L _ G E N E R A T E C U R R E N C Y D A T A )   - o   $ @ . t m p   - i   $ < 
 
   	 $ ( M V )   $ @ . t m p   $ @ 
 
   	 $ ( C H M O D )   4 4 4   $ @ 
 
   
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / g e n s r c / G e n s r c B u f f e r . g m k 
 
 - - -   a / m a k e / g e n s r c / G e n s r c B u f f e r . g m k 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / g e n s r c / G e n s r c B u f f e r . g m k 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 3 0 , 7   + 2 3 0 , 8   @ @ 
 
       e n d i f 
 
   
 
       $ $ ( $ 1 _ D S T ) :   $ $ ( $ 1 _ D E P )   $ ( G E N S R C _ B U F F E R _ D S T ) / _ t h e . b u f f e r . d i r 
 
 - 	 $ ( T O O L _ S P P )   <   $ $ ( $ 1 _ S R C )   >   $ $ ( $ 1 _ O U T ) . t m p   \ 
 
 + 	 $ ( R M )   $ $ ( $ 1 _ O U T ) . t m p 
 
 + 	 $ ( T O O L _ S P P )   - i $ $ ( $ 1 _ S R C )   - o $ $ ( $ 1 _ O U T ) . t m p   \ 
 
   	         - K $ $ ( $ 1 _ t y p e )   \ 
 
   	         - K $ $ ( $ 1 _ c a t e g o r y )   \ 
 
   	         - K $ $ ( $ 1 _ s t r e a m s )   \ 
 
 @ @   - 2 6 0 , 1 2   + 2 6 1 , 1 2   @ @ 
 
                   i f e q   ( $ $ ( $ 1 _ B I N ) ,   1 ) 
 
   	     $ ( S E D )   - e   ' / # B I N / , $ $ $ $ d '   <   $ $ ( $ 1 _ O U T )   >   $ $ ( $ 1 _ D S T ) . t m p 
 
   	     $ ( R M )   $ $ ( $ 1 _ O U T ) 
 
 - 	     $ $ ( $ 1 _ c h a r _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 - 	     $ $ ( $ 1 _ s h o r t _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 - 	     $ $ ( $ 1 _ i n t _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 - 	     $ $ ( $ 1 _ l o n g _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 - 	     $ $ ( $ 1 _ f l o a t _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 - 	     $ $ ( $ 1 _ d o u b l e _ C M D )   <   $ $ ( $ 1 _ S R C _ B I N )   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ c h a r _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ s h o r t _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ i n t _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ l o n g _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ f l o a t _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
 + 	     $ $ ( $ 1 _ d o u b l e _ C M D )   - i $ $ ( $ 1 _ S R C _ B I N )   - o $ $ ( $ 1 _ D S T ) . t m p 
 
   	     $ ( P R I N T F )   " } \ n "   > >   $ $ ( $ 1 _ D S T ) . t m p 
 
   	     m v   $ $ ( $ 1 _ D S T ) . t m p   $ $ ( $ 1 _ D S T ) 
 
                   e n d i f 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / g e n s r c / G e n s r c C h a r s e t C o d e r . g m k 
 
 - - -   a / m a k e / g e n s r c / G e n s r c C h a r s e t C o d e r . g m k 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / g e n s r c / G e n s r c C h a r s e t C o d e r . g m k 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 3 6 , 7   + 3 6 , 7   @ @ 
 
   $ ( G E N S R C _ C H A R S E T C O D E R _ D S T ) / C h a r s e t D e c o d e r . j a v a :   $ ( G E N S R C _ C H A R S E T C O D E R _ T E M P L A T E ) 
 
   	 $ ( c a l l   M a k e T a r g e t D i r ) 
 
   	 $ ( R M )   $ @ . t m p 
 
 - 	 $ ( T O O L _ S P P )   <   $ <   > $ @ . t m p   \ 
 
 + 	 $ ( T O O L _ S P P )   - i $ <   - o $ @ . t m p   \ 
 
   	         - K d e c o d e r   \ 
 
   	         - D A = ' A '   \ 
 
   	         - D a = ' a '   \ 
 
 @ @   - 7 1 , 7   + 7 1 , 7   @ @ 
 
   $ ( G E N S R C _ C H A R S E T C O D E R _ D S T ) / C h a r s e t E n c o d e r . j a v a :   $ ( G E N S R C _ C H A R S E T C O D E R _ T E M P L A T E ) 
 
   	 $ ( c a l l   M a k e T a r g e t D i r ) 
 
   	 $ ( R M )   $ @ . t m p 
 
 - 	 $ ( T O O L _ S P P )   <   $ <   > $ @ . t m p   \ 
 
 + 	 $ ( T O O L _ S P P )   - i $ <   - o $ @ . t m p   \ 
 
   	         - K e n c o d e r   \ 
 
   	         - D A = ' A n '   \ 
 
   	         - D a = ' a n '   \ 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / g e n s r c / G e n s r c V a r H a n d l e s . g m k 
 
 - - -   a / m a k e / g e n s r c / G e n s r c V a r H a n d l e s . g m k 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / g e n s r c / G e n s r c V a r H a n d l e s . g m k 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 5 9 , 8   + 5 9 , 9   @ @ 
 
   	     $ $ ( e v a l   $ 1 _ t y p e   : =   $ $ $ $ ( s h e l l   $ ( T R )   ' [ : u p p e r : ] '   ' [ : l o w e r : ] '   < < <   $ $ $ $ ( $ 1 _ T y p e ) ) ) 
 
                   e n d i f 
 
   	 $ $ ( c a l l   M a k e D i r ,   $ $ ( @ D ) ) 
 
 + 	 $ ( R M )   $ $ @ 
 
   	 $ ( T O O L _ S P P )   - n e l   - K $ $ ( $ 1 _ t y p e )   - D t y p e = $ $ ( $ 1 _ t y p e )   - D T y p e = $ $ ( $ 1 _ T y p e )   \ 
 
 - 	         $ $ ( $ 1 _ A R G S )   <   $ $ <   >   $ $ @ 
 
 + 	         $ $ ( $ 1 _ A R G S )   - i $ $ <   - o $ $ @ 
 
   
 
       G E N S R C _ V A R H A N D L E S   + =   $ $ ( $ 1 _ F I L E N A M E ) 
 
   e n d e f 
 
 @ @   - 1 4 7 , 1 0   + 1 4 8 , 1 1   @ @ 
 
   
 
       $ $ ( $ 1 _ F I L E N A M E ) :   $ ( V A R H A N D L E S _ S R C _ D I R ) / X - V a r H a n d l e B y t e A r r a y V i e w . j a v a . t e m p l a t e   $ ( B U I L D _ T O O L S _ J D K ) 
 
   	 $ $ ( c a l l   M a k e D i r ,   $ $ ( @ D ) ) 
 
 + 	 $ ( R M )   $ $ @ 
 
   	 $ ( T O O L _ S P P )   - n e l   - K $ $ ( $ 1 _ t y p e )   \ 
 
   	         - D t y p e = $ $ ( $ 1 _ t y p e )   - D T y p e = $ $ ( $ 1 _ T y p e )   - D B o x T y p e = $ $ ( $ 1 _ B o x T y p e )   \ 
 
   	         - D r a w T y p e = $ $ ( $ 1 _ r a w T y p e )   - D R a w T y p e = $ $ ( $ 1 _ R a w T y p e )   - D R a w B o x T y p e = $ $ ( $ 1 _ R a w B o x T y p e )   \ 
 
 - 	         $ $ ( $ 1 _ A R G S )   <   $ $ <   >   $ $ @ 
 
 + 	         $ $ ( $ 1 _ A R G S )   - i $ $ <   - o $ $ @ 
 
   
 
       G E N S R C _ V A R H A N D L E S   + =   $ $ ( $ 1 _ F I L E N A M E ) 
 
   e n d e f 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / g e n e r a t e c u r r e n c y d a t a / G e n e r a t e C u r r e n c y D a t a . j a v a 
 
 - - -   a / m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / g e n e r a t e c u r r e n c y d a t a / G e n e r a t e C u r r e n c y D a t a . j a v a 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / g e n e r a t e c u r r e n c y d a t a / G e n e r a t e C u r r e n c y D a t a . j a v a 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 8 , 7   + 2 8 , 9   @ @ 
 
   i m p o r t   j a v a . i o . I O E x c e p t i o n ; 
 
   i m p o r t   j a v a . i o . F i l e N o t F o u n d E x c e p t i o n ; 
 
   i m p o r t   j a v a . i o . D a t a O u t p u t S t r e a m ; 
 
 + i m p o r t   j a v a . i o . F i l e I n p u t S t r e a m ; 
 
   i m p o r t   j a v a . i o . F i l e O u t p u t S t r e a m ; 
 
 + i m p o r t   j a v a . i o . I n p u t S t r e a m ; 
 
   i m p o r t   j a v a . t e x t . S i m p l e D a t e F o r m a t ; 
 
   i m p o r t   j a v a . u t i l . D a t e ; 
 
   i m p o r t   j a v a . u t i l . H a s h M a p ; 
 
 @ @   - 1 3 4 , 1 9   + 1 3 6 , 4 4   @ @ 
 
           p r i v a t e   s t a t i c   S t r i n g   c u r r e n c i e s W i t h M i n o r U n i t s U n d e f i n e d ; 
 
   
 
           p u b l i c   s t a t i c   v o i d   m a i n ( S t r i n g [ ]   a r g s )   { 
 
 - 
 
 + 	         I n p u t S t r e a m   i n   =   S y s t e m . i n ; 
 
                   / /   L o o k   f o r   " - o   o u t p u t f i l e n a m e "   o p t i o n 
 
 -                 i f   (   a r g s . l e n g t h   = =   2   & &   a r g s [ 0 ] . e q u a l s ( " - o " )   )   { 
 
 -                         t r y   { 
 
 -                                 o u t   =   n e w   D a t a O u t p u t S t r e a m ( n e w   F i l e O u t p u t S t r e a m ( a r g s [ 1 ] ) ) ; 
 
 -                         }   c a t c h   (   F i l e N o t F o u n d E x c e p t i o n   e   )   { 
 
 -                                 S y s t e m . e r r . p r i n t l n ( " E r r o r :   "   +   e . g e t M e s s a g e ( ) ) ; 
 
 -                                 e . p r i n t S t a c k T r a c e ( S y s t e m . e r r ) ; 
 
 -                                 S y s t e m . e x i t ( 1 ) ; 
 
 -                         } 
 
 -                 }   e l s e   { 
 
 -                         S y s t e m . e r r . p r i n t l n ( " E r r o r :   I l l e g a l   a r g   c o u n t " ) ; 
 
 -                         S y s t e m . e x i t ( 1 ) ; 
 
 +                 f o r   ( i n t   n   =   0 ;   n   <   a r g s . l e n g t h ;   + + n )   { 
 
 +                         i f   ( a r g s [ n ] . e q u a l s ( " - o " ) )   { 
 
 + 	 	 	 	 + + n ; 
 
 + 	 	 	 	 i f   ( n   > =   a r g s . l e n g t h )   { 
 
 + 	 	 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   I n v a l i d   a r g u m e n t   f o r m a t " ) ; 
 
 + 	 	 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
 + 	 	 	 	 } 
 
 + 	 	 	 	 t r y   { 
 
 + 	 	 	 	 	 o u t   =   n e w   D a t a O u t p u t S t r e a m ( n e w   F i l e O u t p u t S t r e a m ( a r g s [ n ] ) ) ; 
 
 + 	 	 	 	 }   c a t c h   (   F i l e N o t F o u n d E x c e p t i o n   e   )   { 
 
 + 	 	 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   "   +   e . g e t M e s s a g e ( ) ) ; 
 
 + 	 	 	 	 	 e . p r i n t S t a c k T r a c e ( S y s t e m . e r r ) ; 
 
 + 	 	 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
 + 	 	 	 	 } 
 
 + 	 	 	 }   e l s e   i f   ( a r g s [ n ] . e q u a l s ( " - i " ) )   { 
 
 + 	 	 	 	 + + n ; 
 
 + 	 	 	 	 i f   ( n   > =   a r g s . l e n g t h )   { 
 
 + 	 	 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   I n v a l i d   a r g u m e n t   f o r m a t " ) ; 
 
 + 	 	 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
 + 	 	 	 	 } 
 
 + 	 	 	 	 t r y   { 
 
 + 	 	 	 	 	 i n   =   n e w   F i l e I n p u t S t r e a m ( a r g s [ n ] ) ; 
 
 + 	 	 	 	 }   c a t c h   (   F i l e N o t F o u n d E x c e p t i o n   e   )   { 
 
 + 	 	 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   "   +   e . g e t M e s s a g e ( ) ) ; 
 
 + 	 	 	 	 	 e . p r i n t S t a c k T r a c e ( S y s t e m . e r r ) ; 
 
 + 	 	 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
 + 	 	 	 	 } 
 
 + 	 	 	 }   e l s e   { 
 
 + 	 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   I n v a l i d   a r g u m e n t   "   +   a r g s [ n ] ) ; 
 
 + 	 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
 + 	 	 	 } 
 
 +                 } 
 
 + 
 
 +                 i f   ( o u t   = =   n u l l )   { 
 
 + 	 	 	 S y s t e m . e r r . p r i n t l n ( " E r r o r :   I n v a l i d   a r g u m e n t   f o r m a t " ) ; 
 
 + 	 	 	 S y s t e m . e x i t ( 1 ) ; 
 
                   } 
 
   
 
                   f o r m a t   =   n e w   S i m p l e D a t e F o r m a t ( " y y y y - M M - d d - H H - m m - s s " ,   L o c a l e . U S ) ; 
 
 @ @   - 1 5 4 , 7   + 1 8 1 , 7   @ @ 
 
                   f o r m a t . s e t L e n i e n t ( f a l s e ) ; 
 
   
 
                   t r y   { 
 
 -                         r e a d I n p u t ( ) ; 
 
 +                         r e a d I n p u t ( i n ) ; 
 
                           b u i l d M a i n A n d S p e c i a l C a s e T a b l e s ( ) ; 
 
                           b u i l d O t h e r T a b l e s ( ) ; 
 
                           w r i t e O u t p u t ( ) ; 
 
 @ @   - 1 6 7 , 9   + 1 9 4 , 9   @ @ 
 
                   } 
 
           } 
 
   
 
 -         p r i v a t e   s t a t i c   v o i d   r e a d I n p u t ( )   t h r o w s   I O E x c e p t i o n   { 
 
 +         p r i v a t e   s t a t i c   v o i d   r e a d I n p u t ( I n p u t S t r e a m   i n )   t h r o w s   I O E x c e p t i o n   { 
 
                   c u r r e n c y D a t a   =   n e w   P r o p e r t i e s ( ) ; 
 
 -                 c u r r e n c y D a t a . l o a d ( S y s t e m . i n ) ; 
 
 +                 c u r r e n c y D a t a . l o a d ( i n ) ; 
 
   
 
                   / /   i n i t i a l i z e   o t h e r   l o o k u p   s t r i n g s 
 
                   f o r m a t V e r s i o n   =   ( S t r i n g )   c u r r e n c y D a t a . g e t ( " f o r m a t V e r s i o n " ) ; 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / s p p / S p p . j a v a 
 
 - - -   a / m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / s p p / S p p . j a v a 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / j d k / s r c / c l a s s e s / b u i l d / t o o l s / s p p / S p p . j a v a 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 5 , 6   + 2 5 , 8   @ @ 
 
   
 
   p a c k a g e   b u i l d . t o o l s . s p p ; 
 
   
 
 + i m p o r t   j a v a . i o . F i l e I n p u t S t r e a m ; 
 
 + i m p o r t   j a v a . i o . F i l e O u t p u t S t r e a m ; 
 
   i m p o r t   j a v a . u t i l . * ; 
 
   i m p o r t   j a v a . u t i l . r e g e x . * ; 
 
   
 
 @ @   - 6 9 , 6   + 7 1 , 8   @ @ 
 
                   S e t < S t r i n g >   k e y s   =   n e w   H a s h S e t < > ( ) ; 
 
                   b o o l e a n   b e   =   f a l s e ; 
 
                   b o o l e a n   e l   =   t r u e ; 
 
 + 	 	 S t r i n g   i n p u t F i l e   =   n u l l ; 
 
 + 	 	 S t r i n g   o u t p u t F i l e   =   n u l l ; 
 
   
 
                   f o r   ( S t r i n g   a r g : a r g s )   { 
 
                           i f   ( a r g . s t a r t s W i t h ( " - D " ) )   { 
 
 @ @   - 7 6 , 6   + 8 0 , 1 0   @ @ 
 
                                   v a r s . p u t ( a r g . s u b s t r i n g ( 2 ,   i ) , a r g . s u b s t r i n g ( i + 1 ) ) ; 
 
                           }   e l s e   i f   ( a r g . s t a r t s W i t h ( " - K " ) )   { 
 
                                   k e y s . a d d ( a r g . s u b s t r i n g ( 2 ) ) ; 
 
 +                         }   e l s e   i f   ( a r g . s t a r t s W i t h ( " - i " ) )   { 
 
 +                                 i n p u t F i l e   =   a r g . s u b s t r i n g ( 2 ) ; 
 
 +                         }   e l s e   i f   ( a r g . s t a r t s W i t h ( " - o " ) )   { 
 
 +                                 o u t p u t F i l e   =   a r g . s u b s t r i n g ( 2 ) ; 
 
                           }   e l s e   i f   ( " - b e " . e q u a l s ( a r g ) )   { 
 
                                   b e   =   t r u e ; 
 
                           }   e l s e   i f   ( " - n e l " . e q u a l s ( a r g ) )   { 
 
 @ @   - 8 7 , 1 1   + 9 5 , 1 1   @ @ 
 
                   } 
 
   
 
                   S t r i n g B u f f e r   o u t   =   n e w   S t r i n g B u f f e r ( ) ; 
 
 -                 n e w   S p p ( ) . s p p ( n e w   S c a n n e r ( S y s t e m . i n ) , 
 
 +                 n e w   S p p ( ) . s p p ( n e w   S c a n n e r ( n e w   F i l e I n p u t S t r e a m ( i n p u t F i l e ) ) , 
 
                                               o u t ,   " " , 
 
                                               k e y s ,   v a r s ,   b e ,   e l , 
 
                                               f a l s e ) ; 
 
 -                 S y s t e m . o u t . p r i n t ( o u t . t o S t r i n g ( ) ) ; 
 
 +                 n e w   F i l e O u t p u t S t r e a m ( o u t p u t F i l e ,   t r u e ) . w r i t e ( o u t . t o S t r i n g ( ) . g e t B y t e s ( ) ) ; 
 
           } 
 
   
 
           s t a t i c   f i n a l   S t r i n g   L N S E P   =   S y s t e m . g e t P r o p e r t y ( " l i n e . s e p a r a t o r " ) ; 
 
 d i f f   - r   4 b e f 1 9 5 7 a 1 d 8   m a k e / s r c / n a t i v e / f i x p a t h . c 
 
 - - -   a / m a k e / s r c / n a t i v e / f i x p a t h . c 	 T h u   N o v   2 2   1 0 : 1 5 : 3 2   2 0 1 8   - 0 8 0 0 
 
 + + +   b / m a k e / s r c / n a t i v e / f i x p a t h . c 	 M o n   D e c   1 0   2 1 : 1 7 : 0 0   2 0 1 8   - 0 8 0 0 
 
 @ @   - 2 4 , 6   + 2 4 , 7   @ @ 
 
     * / 
 
   
 
   # i n c l u d e   < W i n d o w s . h > 
 
 + # i n c l u d e   < s t d b o o l . h > 
 
   # i n c l u d e   < i o . h > 
 
   # i n c l u d e   < s t d i o . h > 
 
   # i n c l u d e   < s t r i n g . h > 
 
 @ @   - 5 3 , 2 5   + 5 4 , 1 6   @ @ 
 
   } 
 
   
 
   / * 
 
 -   *   T e s t   i f   p o s   p o i n t s   t o   / c y g d r i v e / _ /   w h e r e   _   c a n 
 
 +   *   T e s t   i f   p o s   p o i n t s   t o   / p r e f i x / _ /   w h e r e   _   c a n 
 
     *   b e   a n y   c h a r a c t e r . 
 
     * / 
 
 - i n t   i s _ c y g d r i v e _ h e r e ( i n t   p o s ,   c h a r   c o n s t   * i n ,   i n t   l e n ) 
 
 + i n t   i s _ p r e f i x _ h e r e ( i n t   p o s ,   c h a r   c o n s t   * i n ,   i n t   l e n ,   c o n s t   c h a r *   p r e f i x ) 
 
   { 
 
 -     / /   L e n g t h   o f   / c y g d r i v e / c /   i s   1 2 
 
 -     i f   ( p o s + 1 2   >   l e n )   r e t u r n   0 ; 
 
 -     i f   ( i n [ p o s + 1 1 ] = = ' / '   & & 
 
 -             i n [ p o s + 9 ] = = ' / '   & & 
 
 -             i n [ p o s + 8 ] = = ' e '   & & 
 
 -             i n [ p o s + 7 ] = = ' v '   & & 
 
 -             i n [ p o s + 6 ] = = ' i '   & & 
 
 -             i n [ p o s + 5 ] = = ' r '   & & 
 
 -             i n [ p o s + 4 ] = = ' d '   & & 
 
 -             i n [ p o s + 3 ] = = ' g '   & & 
 
 -             i n [ p o s + 2 ] = = ' y '   & & 
 
 -             i n [ p o s + 1 ] = = ' c '   & & 
 
 -             i n [ p o s + 0 ] = = ' / ' )   { 
 
 -         r e t u r n   1 ; 
 
 +     / /   L e n g t h   o f   c /   i s   2 
 
 +     i n t   p r e f i x _ s i z e   =   s t r l e n ( p r e f i x ) ; 
 
 +     i f   ( p o s + p r e f i x _ s i z e + 2   >   l e n )   r e t u r n   0 ; 
 
 +     i f   ( i n [ p o s + p r e f i x _ s i z e + 1 ] = = ' / ' )   { 
 
 +         r e t u r n   s t r n c m p ( i n   +   p o s ,   p r e f i x ,   p r e f i x _ s i z e )   = =   0 ; 
 
       } 
 
       r e t u r n   0 ; 
 
   } 
 
 @ @   - 9 3 , 7   + 8 5 , 7   @ @ 
 
       } 
 
   
 
       f o r   ( i   =   0 ,   j   =   0 ;   i < l e n ; )   { 
 
 -         i f   ( i s _ c y g d r i v e _ h e r e ( i ,   i n ,   l e n ) )   { 
 
 +         i f   ( i s _ p r e f i x _ h e r e ( i ,   i n ,   l e n ,   " / c y g d r i v e / " ) )   { 
 
               o u t [ j + + ]   =   i n [ i + 1 0 ] ; 
 
               o u t [ j + + ]   =   ' : ' ; 
 
               i + = 1 1 ; 
 
 @ @   - 1 9 6 , 7   + 1 8 8 , 3 9   @ @ 
 
       r e t u r n   s t r ; 
 
   } 
 
   
 
 + / * 
 
 +   *   R e p l a c e   / m n t / _ /   w i t h   _ : / 
 
 +   *   W o r k s   i n   p l a c e   s i n c e   d r i v e   l e t t e r   i s   a l w a y s 
 
 +   *   s h o r t e r   t h a n   / m n t / 
 
 +   * / 
 
 + c h a r   * r e p l a c e _ c y g d r i v e _ w s l ( c h a r   c o n s t   * i n ) 
 
 + { 
 
 +     s i z e _ t   l e n   =   s t r l e n ( i n ) ; 
 
 +     c h a r   * o u t   =   ( c h a r * )   m a l l o c ( l e n + 1 ) ; 
 
 +     i n t   i , j ; 
 
 + 
 
 +     i f   ( l e n   <   7 )   { 
 
 +         m e m m o v e ( o u t ,   i n ,   l e n   +   1 ) ; 
 
 +         r e t u r n   o u t ; 
 
 +     } 
 
 + 
 
 +     f o r   ( i   =   0 ,   j   =   0 ;   i < l e n ; )   { 
 
 +         i f   ( i s _ p r e f i x _ h e r e ( i ,   i n ,   l e n ,   " / m n t / " ) )   { 
 
 +             o u t [ j + + ]   =   i n [ i + 5 ] ; 
 
 +             o u t [ j + + ]   =   ' : ' ; 
 
 +             i + = 6 ; 
 
 +         }   e l s e   { 
 
 +             o u t [ j ]   =   i n [ i ] ; 
 
 +             i + + ; 
 
 +             j + + ; 
 
 +         } 
 
 +     } 
 
 +     o u t [ j ]   =   ' \ 0 ' ; 
 
 +     r e t u r n   o u t ; 
 
 + } 
 
 + 
 
   c h a r * ( * r e p l a c e _ c y g d r i v e ) ( c h a r   c o n s t   * i n )   =   N U L L ; 
 
 + b o o l   d e b u g _ f i x p a t h   =   f a l s e ; 
 
   
 
   c h a r   * f i l e s _ t o _ d e l e t e [ 1 0 2 4 ] ; 
 
   i n t   n u m _ f i l e s _ t o _ d e l e t e   =   0 ; 
 
 @ @   - 2 5 0 , 1 1   + 2 7 4 , 1 1   @ @ 
 
           a p p e n d ( & b u f f e r ,   & b u f l e n ,   & u s e d ,   b l o c k ,   b l o c k l e n ) ; 
 
       } 
 
       b u f f e r [ u s e d ]   =   0 ; 
 
 -     i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +     i f   ( d e b u g _ f i x p a t h )   { 
 
           f p r i n t f ( s t d e r r ,   " f i x p a t h   i n p u t   f r o m   @ - f i l e   % s :   % s \ n " ,   & i n [ 1 ] ,   b u f f e r ) ; 
 
       } 
 
       f i x e d   =   r e p l a c e _ c y g d r i v e ( b u f f e r ) ; 
 
 -     i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +     i f   ( d e b u g _ f i x p a t h )   { 
 
           f p r i n t f ( s t d e r r ,   " f i x p a t h   c o n v e r t e d   t o   @ - f i l e   % s   i s :   % s \ n " ,   n a m e ,   f i x e d ) ; 
 
       } 
 
       f w r i t e ( f i x e d ,   s t r l e n ( f i x e d ) ,   1 ,   a t o u t ) ; 
 
 @ @   - 3 6 3 , 2 7   + 3 8 7 , 3 4   @ @ 
 
           B O O L   p r o c e s s I n h e r i t H a n d l e s   =   T R U E ; 
 
           B O O L   w a i t F o r C h i l d   =   T R U E ; 
 
   
 
 -         i f   ( a r g c < 2   | |   a r g v [ 1 ] [ 0 ]   ! =   ' - '   | |   ( a r g v [ 1 ] [ 1 ]   ! =   ' c '   & &   a r g v [ 1 ] [ 1 ]   ! =   ' m ' ) )   { 
 
 -                 f p r i n t f ( s t d e r r ,   " U s a g e :   f i x p a t h   - c | m < p a t h @ p a t h @ . . . >   [ - - d e t a c h ]   / c y g d r i v e / c / W I N D O W S / n o t e p a d . e x e   [ / c y g d r i v e / c / x / t e s t . t x t | @ / c y g d r i v e / c / x / a t f i l e ] \ n " ) ; 
 
 + 	 d e b u g _ f i x p a t h   =   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L ) ; 
 
 + 
 
 +         i f   ( a r g c < 2   | |   a r g v [ 1 ] [ 0 ]   ! =   ' - '   | |   ( a r g v [ 1 ] [ 1 ]   ! =   ' c '   & &   a r g v [ 1 ] [ 1 ]   ! =   ' m '   & &   a r g v [ 1 ] [ 1 ]   ! =   ' w ' ) )   { 
 
 +                 f p r i n t f ( s t d e r r ,   " U s a g e :   f i x p a t h   - c | m | w < p a t h @ p a t h @ . . . >   [ - - d e t a c h ]   / c y g d r i v e / c / W I N D O W S / n o t e p a d . e x e   [ / c y g d r i v e / c / x / t e s t . t x t | @ / c y g d r i v e / c / x / a t f i l e ] \ n " ) ; 
 
                   e x i t ( 0 ) ; 
 
           } 
 
   
 
 -         i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +         i f   ( d e b u g _ f i x p a t h )   { 
 
               c h a r   c o n s t   *   c m d l i n e   =   G e t C o m m a n d L i n e ( ) ; 
 
               f p r i n t f ( s t d e r r ,   " f i x p a t h   i n p u t   l i n e   > % s < \ n " ,   s t r s t r ( c m d l i n e ,   a r g v [ 1 ] ) ) ; 
 
           } 
 
   
 
           i f   ( a r g v [ 1 ] [ 1 ]   = =   ' c '   & &   a r g v [ 1 ] [ 2 ]   = =   ' \ 0 ' )   { 
 
 -             i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
                   f p r i n t f ( s t d e r r ,   " f i x p a t h   u s i n g   c y g w i n   m o d e \ n " ) ; 
 
               } 
 
               r e p l a c e _ c y g d r i v e   =   r e p l a c e _ c y g d r i v e _ c y g w i n ; 
 
           }   e l s e   i f   ( a r g v [ 1 ] [ 1 ]   = =   ' m ' )   { 
 
 -             i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
                   f p r i n t f ( s t d e r r ,   " f i x p a t h   u s i n g   m s y s   m o d e ,   w i t h   p a t h   l i s t :   % s \ n " ,   & a r g v [ 1 ] [ 2 ] ) ; 
 
               } 
 
               s e t u p _ m s y s _ p a t h _ l i s t ( a r g v [ 1 ] ) ; 
 
               r e p l a c e _ c y g d r i v e   =   r e p l a c e _ c y g d r i v e _ m s y s ; 
 
 + 	 }   e l s e   i f   ( a r g v [ 1 ] [ 1 ]   = =   ' w ' )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
 +                 f p r i n t f ( s t d e r r ,   " f i x p a t h   u s i n g   w s l   m o d e ,   w i t h   p a t h   l i s t :   % s \ n " ,   & a r g v [ 1 ] [ 2 ] ) ; 
 
 +             } 
 
 +             r e p l a c e _ c y g d r i v e   =   r e p l a c e _ c y g d r i v e _ w s l ; 
 
           }   e l s e   { 
 
               f p r i n t f ( s t d e r r ,   " f i x p a t h   U n k n o w n   m o d e :   % s \ n " ,   a r g v [ 1 ] ) ; 
 
               e x i t ( - 1 ) ; 
 
 @ @   - 3 9 1 , 7   + 4 2 2 , 7   @ @ 
 
   
 
           i f   ( a r g v [ 2 ] [ 0 ]   = =   ' - ' )   { 
 
               i f   ( s t r c m p ( a r g v [ 2 ] ,   " - - d e t a c h " )   = =   0 )   { 
 
 -                 i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +                 i f   ( d e b u g _ f i x p a t h )   { 
 
                       f p r i n t f ( s t d e r r ,   " f i x p a t h   i n   d e t a c h e d   m o d e \ n " ) ; 
 
                   } 
 
                   p r o c e s s F l a g s   | =   D E T A C H E D _ P R O C E S S ; 
 
 @ @   - 4 1 7 , 7   + 4 4 8 , 7   @ @ 
 
                   v a r [ v a r _ l e n   -   1 ]   =   ' \ 0 ' ; 
 
                   s t r u p r ( v a r ) ; 
 
   
 
 -                 i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +                 i f   ( d e b u g _ f i x p a t h )   { 
 
                       f p r i n t f ( s t d e r r ,   " f i x p a t h   s e t t i n g   v a r   > % s <   t o   > % s < \ n " ,   v a r ,   v a l ) ; 
 
                   } 
 
   
 
 @ @   - 4 8 0 , 1 2   + 5 1 1 , 1 2   @ @ 
 
           } 
 
           * c u r r e n t   =   ' \ 0 ' ; 
 
   
 
 -         i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +         i f   ( d e b u g _ f i x p a t h )   { 
 
               f p r i n t f ( s t d e r r ,   " f i x p a t h   c o n v e r t e d   l i n e   > % s < \ n " ,   l i n e ) ; 
 
           } 
 
   
 
           i f   ( c m d   = =   a r g c )   { 
 
 -               i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +               i f   ( d e b u g _ f i x p a t h )   { 
 
                     f p r i n t f ( s t d e r r ,   " f i x p a t h   n o   c o m m a n d   p r o v i d e d ! \ n " ) ; 
 
                 } 
 
                 e x i t ( 0 ) ; 
 
 @ @   - 5 1 8 , 7   + 5 4 9 , 7   @ @ 
 
               W a i t F o r S i n g l e O b j e c t ( p i . h P r o c e s s ,   I N F I N I T E ) ; 
 
               G e t E x i t C o d e P r o c e s s ( p i . h P r o c e s s ,   & e x i t C o d e ) ; 
 
   
 
 -             i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
                   f o r   ( i = 0 ;   i < n u m _ f i l e s _ t o _ d e l e t e ;   + + i )   { 
 
                       f p r i n t f ( s t d e r r ,   " f i x p a t h   N o t   d e l e t i n g   t e m p o r a r y   f i l e   % s \ n " , 
 
                                       f i l e s _ t o _ d e l e t e [ i ] ) ; 
 
 @ @   - 5 3 0 , 1 3   + 5 6 1 , 1 3   @ @ 
 
               } 
 
   
 
               i f   ( e x i t C o d e   ! =   0 )   { 
 
 -                 i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +                 i f   ( d e b u g _ f i x p a t h )   { 
 
                       f p r i n t f ( s t d e r r ,   " f i x p a t h   e x i t   c o d e   % d \ n " , 
 
                                       e x i t C o d e ) ; 
 
                   } 
 
               } 
 
           }   e l s e   { 
 
 -             i f   ( g e t e n v ( " D E B U G _ F I X P A T H " )   ! =   N U L L )   { 
 
 +             i f   ( d e b u g _ f i x p a t h )   { 
 
                   f p r i n t f ( s t d e r r ,   " f i x p a t h   N o t   w a i t i n g   f o r   c h i l d   p r o c e s s " ) ; 
 
               } 
 
           } 
 
 


More information about the build-dev mailing list