djunpack.bat revision 225736
1214501Srpaulo@echo off
2214501SrpauloRem
3214501SrpauloRem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
4214501SrpauloRem format, or else stock DOS/Windows shells will refuse to run it.
5252726SrpauloRem
6252726SrpauloRem This batch file unpacks the GDB distribution while simultaneously
7214501SrpauloRem renaming some of the files whose names are invalid on DOS or conflict
8214501SrpauloRem with other file names after truncation to DOS 8+3 namespace.
9214501SrpauloRem
10214501SrpauloRem Invoke like this:
11214501SrpauloRem
12214501SrpauloRem     djunpack gdb-XYZ.tar
13214501SrpauloRem
14214501SrpauloRem where XYZ is the version number.  If the argument includes leading
15214501SrpauloRem directories, it MUST use backslashes, not forward slashes.
16214501SrpauloRem
17214501SrpauloRem The following 2 lines need to be changed with each new GDB release, to
18214501SrpauloRem be identical to the name of the top-level directory where the GDB
19214501SrpauloRem distribution unpacks itself.
20214501Srpauloset GDBVER=gdb-6.1.1
21214501Srpauloif "%GDBVER%"=="gdb-6.1.1" GoTo EnvOk
22214501SrpauloRem If their environment space is too small, re-exec with a larger one
23214501Srpaulocommand.com /e:4096 /c %0 %1
24214501SrpauloGoTo End
25214501Srpaulo:EnvOk
26214501Srpauloif not exist %1 GoTo NoArchive
27214501Srpaulodjtar -x -p -o %GDBVER%/gdb/config/djgpp/fnchange.lst %1 > fnchange.tmp
28214501SrpauloRem The following uses a feature of COPY whereby it does not copy
29214501SrpauloRem empty files.  We need that because the previous line will create
30214501SrpauloRem an empty fnchange.tmp even if the command failed for some reason.
31214501Srpaulocopy fnchange.tmp junk.tmp > nul
32214501Srpauloif not exist junk.tmp GoTo NoDjTar
33214501Srpaulodel junk.tmp
34214501Srpaulosed -e 's,@V@,%GDBVER%,g' < fnchange.tmp > fnchange.lst
35214501SrpauloRem See the comment above about the reason for using COPY.
36214501Srpaulocopy fnchange.lst junk.tmp > nul
37214501Srpauloif not exist junk.tmp GoTo NoSed
38214501Srpaulodel junk.tmp
39214501Srpaulodjtar -x -n fnchange.lst %1
40214501SrpauloGoTo End
41214501Srpaulo:NoSed
42214501Srpauloecho FAIL: Sed is not available.
43214501SrpauloGoTo End
44214501Srpaulo:NoDjTar
45214501Srpauloecho FAIL: DJTAR is not available or no fnchange.lst file in %1.
46214501SrpauloGoTo End
47214501Srpaulo:NoArchive
48214501Srpauloecho FAIL: the file %1 does not seem to exist.
49214501Srpauloecho Remember that %1 cannot use forward slashes, only backslashes.
50214501SrpauloGoTo End
51214501Srpaulo:End
52214501Srpauloset GDBVER=
53214501Srpaulo