]> git.saurik.com Git - bison.git/blame - djgpp/djunpack.bat
Fix some nits reported by twlevo.
[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
f6a6af95 10Rem Copyright (C) 2005, 2006 Free Software Foundation, Inc.\r
02650b7f
PE
11Rem\r
12Rem This program is free software; you can redistribute it and/or modify\r
13Rem it under the terms of the GNU General Public License as published by\r
14Rem the Free Software Foundation; either version 2, or (at your option)\r
15Rem any later version.\r
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
23Rem along with this program; if not, write to the Free Software Foundation,\r
24Rem Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
25Rem\r
26Rem\r
b09a18c5
JMG
27Rem Invoke like this:\r
28Rem\r
f6a6af95
JMG
29Rem djunpack bison-XYZ.tar.gz\r
30Rem or\r
31Rem djunpack bison-XYZ.tar.bz2\r
b09a18c5
JMG
32Rem\r
33Rem where XYZ is the version number. If the argument includes leading\r
34Rem directories, it MUST use backslashes, not forward slashes.\r
35Rem\r
f6a6af95 36\r
b09a18c5
JMG
37set ENVIRONMENT_SIZE_TEST_STRING=ENVIRONMENT_SIZE_TEST_STRING\r
38if "%ENVIRONMENT_SIZE_TEST_STRING%"=="ENVIRONMENT_SIZE_TEST_STRING" GoTo EnvOk\r
39Rem If their environment space is too small, re-exec with a larger one\r
40command.com /e:4096 /c %0 %1\r
41GoTo End\r
f6a6af95 42\r
b09a18c5
JMG
43:EnvOk\r
44set ENVIRONMENT_SIZE_TEST_STRING=\r
45if "%1" == "" GoTo NoArgument\r
46if not exist %1 GoTo NoArchive\r
47Rem Extract top src dir from archive file.\r
48djtar -t %1 > top_src.dir\r
49Rem The following uses a feature of COPY whereby it does not copy\r
50Rem empty files. We need that because the previous line will create\r
51Rem an empty fnchange.tmp even if the command failed for some reason.\r
52copy top_src.dir junk.tmp > nul\r
53if not exist junk.tmp GoTo NoDjTar\r
54del junk.tmp\r
55sed "1{s/^.*bison-/djtar -x -p -o bison-/;s|$|djgpp/fnchange.lst %%1 > fnchange.tmp|};2,$d" top_src.dir > ext_list.bat\r
56Rem See the comment above about the reason for using COPY.\r
57copy ext_list.bat junk.tmp > nul\r
58if not exist junk.tmp GoTo NoSed\r
59del junk.tmp\r
60Rem Extract fnchange.lst from archive.\r
61call ext_list.bat %1\r
62del ext_list.bat\r
63sed "1{s|^.*bison-|s/@V@/bison-|;s|$|g|};2,$d" top_src.dir > version.sed\r
64sed -f version.sed < fnchange.tmp > fnchange.lst\r
65del version.sed\r
66del fnchange.tmp\r
67del top_src.dir\r
68Rem unpack the source distribution\r
69djtar -x -n fnchange.lst %1\r
70del fnchange.lst\r
71GoTo End\r
f6a6af95 72\r
b09a18c5
JMG
73:NoSed\r
74del junk.tmp\r
75echo FAIL: Sed is not available.\r
76GoTo End\r
77:NoDjTar\r
78del junk.tmp\r
79echo FAIL: DJTAR is not available or no fnchange.lst file in %1.\r
80GoTo End\r
81:NoArchive\r
82echo FAIL: the file %1 does not seem to exist.\r
83echo Remember that %1 cannot use forward slashes, only backslashes.\r
84GoTo End\r
85:NoArgument\r
86echo FAIL: no archive file has been specified.\r
87echo Remember that the file name cannot use forward slashes, only backslashes.\r
88:End\r