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