@echo off

rem If DEVICE_DEVS is empty, there is only one argument, a +.

if '%2'=='' goto init

if '%1'=='+' goto noinit

:init

echo + >_temp_.dob

echo # >_temp_.dow

echo /* This file was automatically generated by Ghostscript (gsconfig.bat). */ >_temp_.dh

echo /* See gconfig.c for documentation. */ >>_temp_.dh

echo #include "gsconfig.h" >>_temp_.dh

echo /* */ >_temp_.dop

echo + >_temp_.dlb

echo @echo off >_temp_.bat

goto top

:noinit

shift

:top

if '%1'=='' goto done

if '%1'=='+' goto nofin

copy /b _temp_.bat+%1 >nul

shift

goto top

:done

command /c _temp_.bat >nul

rem	We can't pipe the output of sort directly into uniq,

rem	because of the message from the Watcom DOS extender.

sort <_temp_.dob >_temp_.dtr

uniq _temp_.dtr obj.tr

sort <_temp_.dow >_temp_.dtr

uniq _temp_.dtr objw.tr

sort <_temp_.dop >_temp_.dtr

uniq _temp_.dtr _temp_.dop

copy /b _temp_.dh+_temp_.dop >nul

if exist lib.tr erase lib.tr

rename _temp_.dlb lib.tr

if exist gconfig.h erase gconfig.h

rename _temp_.dh gconfig.h

erase _temp_.d*

erase _temp_*.bat

:nofin

