@echo off
REM check for command line parameters here
if (%1)==() goto USAGE
if (%1)==(/?) set _HELP=YES
if (%1)==(-?) set _HELP=YES
for %%s in (-h -H -help -HELP /h /H /help /HELP) do if (%1)==(%%s) set _HELP=YES
goto BEGIN

:USAGE
echo USAGE: %0 [SDK DIR] [/?]
echo where: [SDK DIR] is the FULLY QUALIFIED path to the root SDK directory.
echo        [/?]      displays this message
goto EGRESS

:BEGIN
if (%_HELP%)==(YES) goto USAGE
if not exist  %0.bat goto BADDIR

REM create the SDKENV.BAT file
echo @echo off>                                                         SDKENV.BAT
echo REM Copyright (c) 1994, Microsoft Corp. All rights reserved.>>     SDKENV.BAT
echo if NOT (%%_ENVSET%%)==() goto MENU>>                               SDKENV.BAT
echo REM remember original prompt and path!>>                           SDKENV.BAT
echo if (%%_prompt%%)==() set _prompt=%%prompt%%>>                      SDKENV.BAT
echo if (%%_path%%)==() set _path=%%path%%>>                            SDKENV.BAT
echo if (%%_include%%)==() set _include=%%include%%>>                   SDKENV.BAT
echo if (%%_lib%%)==() set _lib=%%lib%%>>                               SDKENV.BAT
echo :MENU>>                                                            SDKENV.BAT
echo REM assume a 32bit build environment>>                             SDKENV.BAT
echo if (%%1)==() goto ENVIRON32>>                                      SDKENV.BAT
echo if (%%1)==(16) goto ENVIRON16>>                                    SDKENV.BAT
echo if (%%1)==(32) goto ENVIRON32>>                                    SDKENV.BAT
echo if (%%1)==(RESTORE) goto RESTORE>>                                 SDKENV.BAT
echo if (%%1)==(restore) goto RESTORE>>                                 SDKENV.BAT
echo goto HELP>>                                                        SDKENV.BAT
echo REM>>                                                              SDKENV.BAT
echo :ENVIRON16>>                                                       SDKENV.BAT
echo REM *** add the location of your 16-bit envirnoment here ***>>     SDKENV.BAT
echo set include=%1\inc16;%%_include%%>>                                SDKENV.BAT
echo set lib=%1\lib16;%%_lib%%>>                                        SDKENV.BAT
echo path=%1\bin;%1\binw;%1\binw16;%%_path%%>>                          SDKENV.BAT
echo prompt Chicago 16-bit build$_%%_prompt%%>>                         SDKENV.BAT
echo set _ENVSET=YES>>                                                  SDKENV.BAT
echo goto EGRESS>>                                                      SDKENV.BAT
echo REM>>                                                              SDKENV.BAT
echo :ENVIRON32>>                                                       SDKENV.BAT
echo set include=%1\inc32;%1\c832\include;%1\c832\mfc\include;%%_include%%>> SDKENV.BAT
echo set lib=%1\lib32;%1\c832\lib;%1\c832\mfc\lib;%%_lib%%>>            SDKENV.BAT
echo path=%1\bin;%1\binw;%1\c832\bin;%%_path%%>>                        SDKENV.BAT
echo prompt Chicago 32-bit build$_%%_prompt%%>>                         SDKENV.BAT
echo set _ENVSET=YES>>                                                  SDKENV.BAT
echo goto EGRESS>>                                                      SDKENV.BAT
echo REM>>                                                              SDKENV.BAT
echo :RESTORE>>                                                         SDKENV.BAT
echo path %%_path%%>>                                                   SDKENV.BAT
echo prompt %%_prompt%%>>                                               SDKENV.BAT
echo set include=%%_include%%>>                                         SDKENV.BAT
echo set lib=%%_lib%%>>                                                 SDKENV.BAT
echo set _path=>>                                                       SDKENV.BAT
echo set _prompt=>>                                                     SDKENV.BAT
echo set _include=>>                                                    SDKENV.BAT
echo set _lib=>>                                                        SDKENV.BAT
echo set _ENVSET=>>                                                     SDKENV.BAT
echo goto EGRESS>>                                                      SDKENV.BAT
echo REM>>                                                              SDKENV.BAT
echo :HELP>>                                                            SDKENV.BAT
echo echo USAGE: %%0 [16] [32] [RESTORE]>>                              SDKENV.BAT
echo echo where: [16] sets up the Chicago 16-bit build env.>>           SDKENV.BAT
echo echo        [32] sets up the Chicago 32-bit build env. (DEFAULT)>> SDKENV.BAT
echo echo        [RESTORE] restores original environment>>              SDKENV.BAT
echo goto EGRESS>>                                                      SDKENV.BAT
echo REM>>                                                              SDKENV.BAT
echo :EGRESS>>                                                          SDKENV.BAT

echo.
echo Success! The SDKENV.BAT file contains environment settings needed
echo for developing Chicago 16 and 32-bit applications.  Not included in 
echo the installation is a make utility, assembler, and a 16-bit compiler.
echo You will need to manually add these tool's location information in 
echo the buildenv batch file.                                        
echo.

goto EGRESS

:BADDIR
echo ERROR: %1 is not the FULLY QUALIFIED path to the SDK directory.
goto EGRESS

:EGRESS
set _HELP=
