]> git.saurik.com Git - bison.git/blame - djgpp/djunpack.bat
Do not allow identifiers that start with a dash.
[bison.git] / djgpp / djunpack.bat
CommitLineData
b09a18c5
JMG
1@echo off\r
2Rem\r
3Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line\r
4Rem format, or else stock DOS/Windows shells will refuse to run it.\r
5Rem\r
6Rem This batch file unpacks the Bison distribution while simultaneously\r
7Rem renaming some of the files whose names are invalid on DOS or conflict\r
8Rem with other file names after truncation to DOS 8+3 namespace.\r
9Rem\r
575619af 10Rem Copyright (C) 2005-2011 Free Software Foundation, Inc.\r
02650b7f 11Rem\r
f16b0819 12Rem This program is free software: you can redistribute it and/or modify\r
02650b7f 13Rem it under the terms of the GNU General Public License as published by\r
f16b0819
PE
14Rem the Free Software Foundation, either version 3 of the License, or\r
15Rem (at your option) any later version.\r
02650b7f
PE
16Rem\r
17Rem This program is distributed in the hope that it will be useful,\r
18Rem but WITHOUT ANY WARRANTY; without even the implied warranty of\r
19Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
20Rem GNU General Public License for more details.\r
21Rem\r
22Rem You should have received a copy of the GNU General Public License\r
f16b0819 23Rem along with this program. If not, see <http://www.gnu.org/licenses/>.\r
02650b7f
PE
24Rem\r
25Rem\r
b09a18c5
JMG
26Rem Invoke like this:\r
27Rem\r
f6a6af95
JMG
28Rem djunpack bison-XYZ.tar.gz\r
29Rem or\r
30Rem djunpack bison-XYZ.tar.bz2\r
b09a18c5
JMG
31Rem\r
32Rem where XYZ is the version number. If the argument includes leading\r
33Rem directories, it MUST use backslashes, not forward slashes.\r
34Rem\r
f6a6af95 35\r
b09a18c5
JMG
36set ENVIRONMENT_SIZE_TEST_STRING=ENVIRONMENT_SIZE_TEST_STRING\r
37if "%ENVIRONMENT_SIZE_TEST_STRING%"=="ENVIRONMENT_SIZE_TEST_STRING" GoTo EnvOk\r
38Rem If their environment space is too small, re-exec with a larger one\r
39command.com /e:4096 /c %0 %1\r
40GoTo End\r
f6a6af95 41\r
b09a18c5
JMG
42:EnvOk\r
43set ENVIRONMENT_SIZE_TEST_STRING=\r
44if "%1" == "" GoTo NoArgument\r
45if not exist %1 GoTo NoArchive\r
46Rem Extract top src dir from archive file.\r
47djtar -t %1 > top_src.dir\r
48Rem The following uses a feature of COPY whereby it does not copy\r
49Rem empty files. We need that because the previous line will create\r
50Rem an empty fnchange.tmp even if the command failed for some reason.\r
51copy top_src.dir junk.tmp > nul\r
52if not exist junk.tmp GoTo NoDjTar\r
53del junk.tmp\r
54sed "1{s/^.*bison-/djtar -x -p -o bison-/;s|$|djgpp/fnchange.lst %%1 > fnchange.tmp|};2,$d" top_src.dir > ext_list.bat\r
55Rem See the comment above about the reason for using COPY.\r
56copy ext_list.bat junk.tmp > nul\r
57if not exist junk.tmp GoTo NoSed\r
58del junk.tmp\r
59Rem Extract fnchange.lst from archive.\r
60call ext_list.bat %1\r
61del ext_list.bat\r
62sed "1{s|^.*bison-|s/@V@/bison-|;s|$|g|};2,$d" top_src.dir > version.sed\r
63sed -f version.sed < fnchange.tmp > fnchange.lst\r
64del version.sed\r
65del fnchange.tmp\r
66del top_src.dir\r
67Rem unpack the source distribution\r
68djtar -x -n fnchange.lst %1\r
69del fnchange.lst\r
70GoTo End\r
f6a6af95 71\r
b09a18c5
JMG
72:NoSed\r
73del junk.tmp\r
74echo FAIL: Sed is not available.\r
75GoTo End\r
76:NoDjTar\r
77del junk.tmp\r
78echo FAIL: DJTAR is not available or no fnchange.lst file in %1.\r
79GoTo End\r
80:NoArchive\r
81echo FAIL: the file %1 does not seem to exist.\r
82echo Remember that %1 cannot use forward slashes, only backslashes.\r
83GoTo End\r
84:NoArgument\r
85echo FAIL: no archive file has been specified.\r
86echo Remember that the file name cannot use forward slashes, only backslashes.\r
87:End\r