1130803Smarcel@echo off
2130803SmarcelRem
3130803SmarcelRem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
4130803SmarcelRem format, or else stock DOS/Windows shells will refuse to run it.
5130803SmarcelRem
6130803SmarcelRem This batch file unpacks the GDB distribution while simultaneously
7130803SmarcelRem renaming some of the files whose names are invalid on DOS or conflict
8130803SmarcelRem with other file names after truncation to DOS 8+3 namespace.
9130803SmarcelRem
10130803SmarcelRem Invoke like this:
11130803SmarcelRem
12130803SmarcelRem     djunpack gdb-XYZ.tar
13130803SmarcelRem
14130803SmarcelRem where XYZ is the version number.  If the argument includes leading
15130803SmarcelRem directories, it MUST use backslashes, not forward slashes.
16130803SmarcelRem
17130803SmarcelRem The following 2 lines need to be changed with each new GDB release, to
18130803SmarcelRem be identical to the name of the top-level directory where the GDB
19130803SmarcelRem distribution unpacks itself.
20130803Smarcelset GDBVER=gdb-6.1.1
21130803Smarcelif "%GDBVER%"=="gdb-6.1.1" GoTo EnvOk
22130803SmarcelRem If their environment space is too small, re-exec with a larger one
23130803Smarcelcommand.com /e:4096 /c %0 %1
24130803SmarcelGoTo End
25130803Smarcel:EnvOk
26130803Smarcelif not exist %1 GoTo NoArchive
27130803Smarceldjtar -x -p -o %GDBVER%/gdb/config/djgpp/fnchange.lst %1 > fnchange.tmp
28130803SmarcelRem The following uses a feature of COPY whereby it does not copy
29130803SmarcelRem empty files.  We need that because the previous line will create
30130803SmarcelRem an empty fnchange.tmp even if the command failed for some reason.
31130803Smarcelcopy fnchange.tmp junk.tmp > nul
32130803Smarcelif not exist junk.tmp GoTo NoDjTar
33130803Smarceldel junk.tmp
34130803Smarcelsed -e 's,@V@,%GDBVER%,g' < fnchange.tmp > fnchange.lst
35130803SmarcelRem See the comment above about the reason for using COPY.
36130803Smarcelcopy fnchange.lst junk.tmp > nul
37130803Smarcelif not exist junk.tmp GoTo NoSed
38130803Smarceldel junk.tmp
39130803Smarceldjtar -x -n fnchange.lst %1
40130803SmarcelGoTo End
41130803Smarcel:NoSed
42130803Smarcelecho FAIL: Sed is not available.
43130803SmarcelGoTo End
44130803Smarcel:NoDjTar
45130803Smarcelecho FAIL: DJTAR is not available or no fnchange.lst file in %1.
46130803SmarcelGoTo End
47130803Smarcel:NoArchive
48130803Smarcelecho FAIL: the file %1 does not seem to exist.
49130803Smarcelecho Remember that %1 cannot use forward slashes, only backslashes.
50130803SmarcelGoTo End
51130803Smarcel:End
52130803Smarcelset GDBVER=
53