mirror of
https://github.com/reactos/CMake.git
synced 2024-11-27 21:41:03 +00:00
Merge topic 'update-bzip2'
592ce3e89b
Merge branch 'upstream-bzip2' into update-bzip203e9d5afb3
bzip2 2019-07-13 (6a8690fc)39f2a9b286
bzip2: Update import script to get bzip2 1.0.835acaa90c5
bzip2: Add compilation flags to disable warnings in third-party code3d47b0ae97
Merge branch 'upstream-bzip2' into update-bzip205c3d1bcdb
bzip2 2007-12-10 (a1d78c55)2c40844891
bzip2: Remove all sources to make room for fresh import09ab19a696
bzip2: add script to import bzip2 from upstream Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4391
This commit is contained in:
commit
64198c4f07
27
Utilities/Scripts/update-bzip2.bash
Executable file
27
Utilities/Scripts/update-bzip2.bash
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
shopt -s dotglob
|
||||
|
||||
readonly name="bzip2"
|
||||
readonly ownership="bzip2 upstream <kwrobot@kitware.com>"
|
||||
readonly subtree="Utilities/cmbzip2"
|
||||
readonly repo="https://sourceware.org/git/bzip2.git"
|
||||
readonly tag="bzip2-1.0.8"
|
||||
readonly shortlog=false
|
||||
readonly paths="
|
||||
LICENSE
|
||||
README
|
||||
*.c
|
||||
*.h
|
||||
"
|
||||
|
||||
extract_source () {
|
||||
git_archive
|
||||
pushd "${extractdir}/${name}-reduced"
|
||||
echo "* -whitespace" > .gitattributes
|
||||
popd
|
||||
}
|
||||
|
||||
. "${BASH_SOURCE%/*}/update-third-party.bash"
|
1
Utilities/cmbzip2/.gitattributes
vendored
Normal file
1
Utilities/cmbzip2/.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
* -whitespace
|
@ -1,319 +0,0 @@
|
||||
------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------
|
||||
|
||||
|
||||
0.9.0
|
||||
~~~~~
|
||||
First version.
|
||||
|
||||
|
||||
0.9.0a
|
||||
~~~~~~
|
||||
Removed 'ranlib' from Makefile, since most modern Unix-es
|
||||
don't need it, or even know about it.
|
||||
|
||||
|
||||
0.9.0b
|
||||
~~~~~~
|
||||
Fixed a problem with error reporting in bzip2.c. This does not effect
|
||||
the library in any way. Problem is: versions 0.9.0 and 0.9.0a (of the
|
||||
program proper) compress and decompress correctly, but give misleading
|
||||
error messages (internal panics) when an I/O error occurs, instead of
|
||||
reporting the problem correctly. This shouldn't give any data loss
|
||||
(as far as I can see), but is confusing.
|
||||
|
||||
Made the inline declarations disappear for non-GCC compilers.
|
||||
|
||||
|
||||
0.9.0c
|
||||
~~~~~~
|
||||
Fixed some problems in the library pertaining to some boundary cases.
|
||||
This makes the library behave more correctly in those situations. The
|
||||
fixes apply only to features (calls and parameters) not used by
|
||||
bzip2.c, so the non-fixedness of them in previous versions has no
|
||||
effect on reliability of bzip2.c.
|
||||
|
||||
In bzlib.c:
|
||||
* made zero-length BZ_FLUSH work correctly in bzCompress().
|
||||
* fixed bzWrite/bzRead to ignore zero-length requests.
|
||||
* fixed bzread to correctly handle read requests after EOF.
|
||||
* wrong parameter order in call to bzDecompressInit in
|
||||
bzBuffToBuffDecompress. Fixed.
|
||||
|
||||
In compress.c:
|
||||
* changed setting of nGroups in sendMTFValues() so as to
|
||||
do a bit better on small files. This _does_ effect
|
||||
bzip2.c.
|
||||
|
||||
|
||||
0.9.5a
|
||||
~~~~~~
|
||||
Major change: add a fallback sorting algorithm (blocksort.c)
|
||||
to give reasonable behaviour even for very repetitive inputs.
|
||||
Nuked --repetitive-best and --repetitive-fast since they are
|
||||
no longer useful.
|
||||
|
||||
Minor changes: mostly a whole bunch of small changes/
|
||||
bugfixes in the driver (bzip2.c). Changes pertaining to the
|
||||
user interface are:
|
||||
|
||||
allow decompression of symlink'd files to stdout
|
||||
decompress/test files even without .bz2 extension
|
||||
give more accurate error messages for I/O errors
|
||||
when compressing/decompressing to stdout, don't catch control-C
|
||||
read flags from BZIP2 and BZIP environment variables
|
||||
decline to break hard links to a file unless forced with -f
|
||||
allow -c flag even with no filenames
|
||||
preserve file ownerships as far as possible
|
||||
make -s -1 give the expected block size (100k)
|
||||
add a flag -q --quiet to suppress nonessential warnings
|
||||
stop decoding flags after --, so files beginning in - can be handled
|
||||
resolved inconsistent naming: bzcat or bz2cat ?
|
||||
bzip2 --help now returns 0
|
||||
|
||||
Programming-level changes are:
|
||||
|
||||
fixed syntax error in GET_LL4 for Borland C++ 5.02
|
||||
let bzBuffToBuffDecompress return BZ_DATA_ERROR{_MAGIC}
|
||||
fix overshoot of mode-string end in bzopen_or_bzdopen
|
||||
wrapped bzlib.h in #ifdef __cplusplus ... extern "C" { ... }
|
||||
close file handles under all error conditions
|
||||
added minor mods so it compiles with DJGPP out of the box
|
||||
fixed Makefile so it doesn't give problems with BSD make
|
||||
fix uninitialised memory reads in dlltest.c
|
||||
|
||||
0.9.5b
|
||||
~~~~~~
|
||||
Open stdin/stdout in binary mode for DJGPP.
|
||||
|
||||
0.9.5c
|
||||
~~~~~~
|
||||
Changed BZ_N_OVERSHOOT to be ... + 2 instead of ... + 1. The + 1
|
||||
version could cause the sorted order to be wrong in some extremely
|
||||
obscure cases. Also changed setting of quadrant in blocksort.c.
|
||||
|
||||
0.9.5d
|
||||
~~~~~~
|
||||
The only functional change is to make bzlibVersion() in the library
|
||||
return the correct string. This has no effect whatsoever on the
|
||||
functioning of the bzip2 program or library. Added a couple of casts
|
||||
so the library compiles without warnings at level 3 in MS Visual
|
||||
Studio 6.0. Included a Y2K statement in the file Y2K_INFO. All other
|
||||
changes are minor documentation changes.
|
||||
|
||||
1.0
|
||||
~~~
|
||||
Several minor bugfixes and enhancements:
|
||||
|
||||
* Large file support. The library uses 64-bit counters to
|
||||
count the volume of data passing through it. bzip2.c
|
||||
is now compiled with -D_FILE_OFFSET_BITS=64 to get large
|
||||
file support from the C library. -v correctly prints out
|
||||
file sizes greater than 4 gigabytes. All these changes have
|
||||
been made without assuming a 64-bit platform or a C compiler
|
||||
which supports 64-bit ints, so, except for the C library
|
||||
aspect, they are fully portable.
|
||||
|
||||
* Decompression robustness. The library/program should be
|
||||
robust to any corruption of compressed data, detecting and
|
||||
handling _all_ corruption, instead of merely relying on
|
||||
the CRCs. What this means is that the program should
|
||||
never crash, given corrupted data, and the library should
|
||||
always return BZ_DATA_ERROR.
|
||||
|
||||
* Fixed an obscure race-condition bug only ever observed on
|
||||
Solaris, in which, if you were very unlucky and issued
|
||||
control-C at exactly the wrong time, both input and output
|
||||
files would be deleted.
|
||||
|
||||
* Don't run out of file handles on test/decompression when
|
||||
large numbers of files have invalid magic numbers.
|
||||
|
||||
* Avoid library namespace pollution. Prefix all exported
|
||||
symbols with BZ2_.
|
||||
|
||||
* Minor sorting enhancements from my DCC2000 paper.
|
||||
|
||||
* Advance the version number to 1.0, so as to counteract the
|
||||
(false-in-this-case) impression some people have that programs
|
||||
with version numbers less than 1.0 are in some way, experimental,
|
||||
pre-release versions.
|
||||
|
||||
* Create an initial Makefile-libbz2_so to build a shared library.
|
||||
Yes, I know I should really use libtool et al ...
|
||||
|
||||
* Make the program exit with 2 instead of 0 when decompression
|
||||
fails due to a bad magic number (ie, an invalid bzip2 header).
|
||||
Also exit with 1 (as the manual claims :-) whenever a diagnostic
|
||||
message would have been printed AND the corresponding operation
|
||||
is aborted, for example
|
||||
bzip2: Output file xx already exists.
|
||||
When a diagnostic message is printed but the operation is not
|
||||
aborted, for example
|
||||
bzip2: Can't guess original name for wurble -- using wurble.out
|
||||
then the exit value 0 is returned, unless some other problem is
|
||||
also detected.
|
||||
|
||||
I think it corresponds more closely to what the manual claims now.
|
||||
|
||||
|
||||
1.0.1
|
||||
~~~~~
|
||||
* Modified dlltest.c so it uses the new BZ2_ naming scheme.
|
||||
* Modified makefile-msc to fix minor build probs on Win2k.
|
||||
* Updated README.COMPILATION.PROBLEMS.
|
||||
|
||||
There are no functionality changes or bug fixes relative to version
|
||||
1.0.0. This is just a documentation update + a fix for minor Win32
|
||||
build problems. For almost everyone, upgrading from 1.0.0 to 1.0.1 is
|
||||
utterly pointless. Don't bother.
|
||||
|
||||
|
||||
1.0.2
|
||||
~~~~~
|
||||
A bug fix release, addressing various minor issues which have appeared
|
||||
in the 18 or so months since 1.0.1 was released. Most of the fixes
|
||||
are to do with file-handling or documentation bugs. To the best of my
|
||||
knowledge, there have been no data-loss-causing bugs reported in the
|
||||
compression/decompression engine of 1.0.0 or 1.0.1.
|
||||
|
||||
Note that this release does not improve the rather crude build system
|
||||
for Unix platforms. The general plan here is to autoconfiscate/
|
||||
libtoolise 1.0.2 soon after release, and release the result as 1.1.0
|
||||
or perhaps 1.2.0. That, however, is still just a plan at this point.
|
||||
|
||||
Here are the changes in 1.0.2. Bug-reporters and/or patch-senders in
|
||||
parentheses.
|
||||
|
||||
* Fix an infinite segfault loop in 1.0.1 when a directory is
|
||||
encountered in -f (force) mode.
|
||||
(Trond Eivind Glomsrod, Nicholas Nethercote, Volker Schmidt)
|
||||
|
||||
* Avoid double fclose() of output file on certain I/O error paths.
|
||||
(Solar Designer)
|
||||
|
||||
* Don't fail with internal error 1007 when fed a long stream (> 48MB)
|
||||
of byte 251. Also print useful message suggesting that 1007s may be
|
||||
caused by bad memory.
|
||||
(noticed by Juan Pedro Vallejo, fixed by me)
|
||||
|
||||
* Fix uninitialised variable silly bug in demo prog dlltest.c.
|
||||
(Jorj Bauer)
|
||||
|
||||
* Remove 512-MB limitation on recovered file size for bzip2recover
|
||||
on selected platforms which support 64-bit ints. At the moment
|
||||
all GCC supported platforms, and Win32.
|
||||
(me, Alson van der Meulen)
|
||||
|
||||
* Hard-code header byte values, to give correct operation on platforms
|
||||
using EBCDIC as their native character set (IBM's OS/390).
|
||||
(Leland Lucius)
|
||||
|
||||
* Copy file access times correctly.
|
||||
(Marty Leisner)
|
||||
|
||||
* Add distclean and check targets to Makefile.
|
||||
(Michael Carmack)
|
||||
|
||||
* Parameterise use of ar and ranlib in Makefile. Also add $(LDFLAGS).
|
||||
(Rich Ireland, Bo Thorsen)
|
||||
|
||||
* Pass -p (create parent dirs as needed) to mkdir during make install.
|
||||
(Jeremy Fusco)
|
||||
|
||||
* Dereference symlinks when copying file permissions in -f mode.
|
||||
(Volker Schmidt)
|
||||
|
||||
* Majorly simplify implementation of uInt64_qrm10.
|
||||
(Bo Lindbergh)
|
||||
|
||||
* Check the input file still exists before deleting the output one,
|
||||
when aborting in cleanUpAndFail().
|
||||
(Joerg Prante, Robert Linden, Matthias Krings)
|
||||
|
||||
Also a bunch of patches courtesy of Philippe Troin, the Debian maintainer
|
||||
of bzip2:
|
||||
|
||||
* Wrapper scripts (with manpages): bzdiff, bzgrep, bzmore.
|
||||
|
||||
* Spelling changes and minor enhancements in bzip2.1.
|
||||
|
||||
* Avoid race condition between creating the output file and setting its
|
||||
interim permissions safely, by using fopen_output_safely().
|
||||
No changes to bzip2recover since there is no issue with file
|
||||
permissions there.
|
||||
|
||||
* do not print senseless report with -v when compressing an empty
|
||||
file.
|
||||
|
||||
* bzcat -f works on non-bzip2 files.
|
||||
|
||||
* do not try to escape shell meta-characters on unix (the shell takes
|
||||
care of these).
|
||||
|
||||
* added --fast and --best aliases for -1 -9 for gzip compatibility.
|
||||
|
||||
|
||||
1.0.3 (15 Feb 05)
|
||||
~~~~~~~~~~~~~~~~~
|
||||
Fixes some minor bugs since the last version, 1.0.2.
|
||||
|
||||
* Further robustification against corrupted compressed data.
|
||||
There are currently no known bitstreams which can cause the
|
||||
decompressor to crash, loop or access memory which does not
|
||||
belong to it. If you are using bzip2 or the library to
|
||||
decompress bitstreams from untrusted sources, an upgrade
|
||||
to 1.0.3 is recommended. This fixes CAN-2005-1260.
|
||||
|
||||
* The documentation has been converted to XML, from which html
|
||||
and pdf can be derived.
|
||||
|
||||
* Various minor bugs in the documentation have been fixed.
|
||||
|
||||
* Fixes for various compilation warnings with newer versions of
|
||||
gcc, and on 64-bit platforms.
|
||||
|
||||
* The BZ_NO_STDIO cpp symbol was not properly observed in 1.0.2.
|
||||
This has been fixed.
|
||||
|
||||
|
||||
1.0.4 (20 Dec 06)
|
||||
~~~~~~~~~~~~~~~~~
|
||||
Fixes some minor bugs since the last version, 1.0.3.
|
||||
|
||||
* Fix file permissions race problem (CAN-2005-0953).
|
||||
|
||||
* Avoid possible segfault in BZ2_bzclose. From Coverity's NetBSD
|
||||
scan.
|
||||
|
||||
* 'const'/prototype cleanups in the C code.
|
||||
|
||||
* Change default install location to /usr/local, and handle multiple
|
||||
'make install's without error.
|
||||
|
||||
* Sanitise file names more carefully in bzgrep. Fixes CAN-2005-0758
|
||||
to the extent that applies to bzgrep.
|
||||
|
||||
* Use 'mktemp' rather than 'tempfile' in bzdiff.
|
||||
|
||||
* Tighten up a couple of assertions in blocksort.c following automated
|
||||
analysis.
|
||||
|
||||
* Fix minor doc/comment bugs.
|
||||
|
||||
|
||||
1.0.5 (10 Dec 07)
|
||||
~~~~~~~~~~~~~~~~~
|
||||
Security fix only. Fixes CERT-FI 20469 as it applies to bzip2.
|
||||
|
@ -1,4 +1,13 @@
|
||||
project(bzip2)
|
||||
|
||||
# Disable warnings to avoid changing 3rd party code.
|
||||
if(CMAKE_C_COMPILER_ID MATCHES
|
||||
"^(GNU|Clang|AppleClang|XLClang|XL|VisualAge|SunPro|HP|Intel)$")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
|
||||
elseif(CMAKE_C_COMPILER_ID STREQUAL "PathScale")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -woffall")
|
||||
endif()
|
||||
|
||||
add_definitions(-D_FILE_OFFSET_BITS=64)
|
||||
add_library(cmbzip2
|
||||
blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c)
|
||||
|
@ -2,7 +2,7 @@
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
This program, "bzip2", the associated library "libbzip2", and all
|
||||
documentation, are copyright (C) 1996-2007 Julian R Seward. All
|
||||
documentation, are copyright (C) 1996-2019 Julian R Seward. All
|
||||
rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -36,7 +36,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Julian Seward, jseward@bzip.org
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Julian Seward, jseward@acm.org
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
@ -1,59 +0,0 @@
|
||||
|
||||
# This Makefile builds a shared version of the library,
|
||||
# libbz2.so.1.0.4, with soname libbz2.so.1.0,
|
||||
# at least on x86-Linux (RedHat 7.2),
|
||||
# with gcc-2.96 20000731 (Red Hat Linux 7.1 2.96-98).
|
||||
# Please see the README file for some important info
|
||||
# about building the library like this.
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# This file is part of bzip2/libbzip2, a program and library for
|
||||
# lossless, block-sorting data compression.
|
||||
#
|
||||
# bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
# Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
#
|
||||
# Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
# README file.
|
||||
#
|
||||
# This program is released under the terms of the license contained
|
||||
# in the file LICENSE.
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
|
||||
SHELL=/bin/sh
|
||||
CC=gcc
|
||||
BIGFILES=-D_FILE_OFFSET_BITS=64
|
||||
CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES)
|
||||
|
||||
OBJS= blocksort.o \
|
||||
huffman.o \
|
||||
crctable.o \
|
||||
randtable.o \
|
||||
compress.o \
|
||||
decompress.o \
|
||||
bzlib.o
|
||||
|
||||
all: $(OBJS)
|
||||
$(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.4 $(OBJS)
|
||||
$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.4
|
||||
rm -f libbz2.so.1.0
|
||||
ln -s libbz2.so.1.0.4 libbz2.so.1.0
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) bzip2.o libbz2.so.1.0.4 libbz2.so.1.0 bzip2-shared
|
||||
|
||||
blocksort.o: blocksort.c
|
||||
$(CC) $(CFLAGS) -c blocksort.c
|
||||
huffman.o: huffman.c
|
||||
$(CC) $(CFLAGS) -c huffman.c
|
||||
crctable.o: crctable.c
|
||||
$(CC) $(CFLAGS) -c crctable.c
|
||||
randtable.o: randtable.c
|
||||
$(CC) $(CFLAGS) -c randtable.c
|
||||
compress.o: compress.c
|
||||
$(CC) $(CFLAGS) -c compress.c
|
||||
decompress.o: decompress.c
|
||||
$(CC) $(CFLAGS) -c decompress.c
|
||||
bzlib.o: bzlib.c
|
||||
$(CC) $(CFLAGS) -c bzlib.c
|
@ -6,8 +6,8 @@ This version is fully compatible with the previous public releases.
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in this file.
|
||||
|
||||
@ -73,7 +73,7 @@ HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc.
|
||||
|
||||
It's difficult for me to support compilation on all these platforms.
|
||||
My approach is to collect binaries for these platforms, and put them
|
||||
on the master web site (http://www.bzip.org). Look there. However
|
||||
on the master web site (https://sourceware.org/bzip2/). Look there. However
|
||||
(FWIW), bzip2-1.0.X is very standard ANSI C and should compile
|
||||
unmodified with MS Visual C. If you have difficulties building, you
|
||||
might want to read README.COMPILATION.PROBLEMS.
|
||||
@ -161,39 +161,22 @@ WHAT'S NEW IN 0.9.5 ?
|
||||
* Many small improvements in file and flag handling.
|
||||
* A Y2K statement.
|
||||
|
||||
WHAT'S NEW IN 1.0.0 ?
|
||||
WHAT'S NEW IN 1.0.x ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
WHAT'S NEW IN 1.0.2 ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
WHAT'S NEW IN 1.0.3 ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
WHAT'S NEW IN 1.0.4 ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
WHAT'S NEW IN 1.0.5 ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
|
||||
I hope you find bzip2 useful. Feel free to contact me at
|
||||
jseward@bzip.org
|
||||
I hope you find bzip2 useful. Feel free to contact the developers at
|
||||
bzip2-devel@sourceware.org
|
||||
if you have any suggestions or queries. Many people mailed me with
|
||||
comments, suggestions and patches after the releases of bzip-0.15,
|
||||
bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
|
||||
1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this
|
||||
feedback. I thank you for your comments.
|
||||
|
||||
bzip2's "home" is http://www.bzip.org/
|
||||
bzip2's "home" is https://sourceware.org/bzip2/
|
||||
|
||||
Julian Seward
|
||||
jseward@bzip.org
|
||||
jseward@acm.org
|
||||
Cambridge, UK.
|
||||
|
||||
18 July 1996 (version 0.15)
|
||||
@ -208,3 +191,6 @@ Cambridge, UK.
|
||||
15 February 2005 (bzip2, version 1.0.3)
|
||||
20 December 2006 (bzip2, version 1.0.4)
|
||||
10 December 2007 (bzip2, version 1.0.5)
|
||||
6 Sept 2010 (bzip2, version 1.0.6)
|
||||
27 June 2019 (bzip2, version 1.0.7)
|
||||
13 July 2019 (bzip2, version 1.0.8)
|
||||
|
@ -1,58 +0,0 @@
|
||||
------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------
|
||||
|
||||
bzip2-1.0.5 should compile without problems on the vast majority of
|
||||
platforms. Using the supplied Makefile, I've built and tested it
|
||||
myself for x86-linux and amd64-linux. With makefile.msc, Visual C++
|
||||
6.0 and nmake, you can build a native Win32 version too. Large file
|
||||
support seems to work correctly on at least on amd64-linux.
|
||||
|
||||
When I say "large file" I mean a file of size 2,147,483,648 (2^31)
|
||||
bytes or above. Many older OSs can't handle files above this size,
|
||||
but many newer ones can. Large files are pretty huge -- most files
|
||||
you'll encounter are not Large Files.
|
||||
|
||||
Early versions of bzip2 (0.1, 0.9.0, 0.9.5) compiled on a wide variety
|
||||
of platforms without difficulty, and I hope this version will continue
|
||||
in that tradition. However, in order to support large files, I've had
|
||||
to include the define -D_FILE_OFFSET_BITS=64 in the Makefile. This
|
||||
can cause problems.
|
||||
|
||||
The technique of adding -D_FILE_OFFSET_BITS=64 to get large file
|
||||
support is, as far as I know, the Recommended Way to get correct large
|
||||
file support. For more details, see the Large File Support
|
||||
Specification, published by the Large File Summit, at
|
||||
|
||||
http://ftp.sas.com/standards/large.file
|
||||
|
||||
As a general comment, if you get compilation errors which you think
|
||||
are related to large file support, try removing the above define from
|
||||
the Makefile, ie, delete the line
|
||||
|
||||
BIGFILES=-D_FILE_OFFSET_BITS=64
|
||||
|
||||
from the Makefile, and do 'make clean ; make'. This will give you a
|
||||
version of bzip2 without large file support, which, for most
|
||||
applications, is probably not a problem.
|
||||
|
||||
Alternatively, try some of the platform-specific hints listed below.
|
||||
|
||||
You can use the spewG.c program to generate huge files to test bzip2's
|
||||
large file support, if you are feeling paranoid. Be aware though that
|
||||
any compilation problems which affect bzip2 will also affect spewG.c,
|
||||
alas.
|
||||
|
||||
AIX: I have reports that for large file support, you need to specify
|
||||
-D_LARGE_FILES rather than -D_FILE_OFFSET_BITS=64. I have not tested
|
||||
this myself.
|
@ -1,45 +0,0 @@
|
||||
----------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
----------------------------------------------------------------
|
||||
|
||||
The script xmlproc.sh takes an xml file as input,
|
||||
and processes it to create .pdf, .html or .ps output.
|
||||
It uses format.pl, a perl script to format <pre> blocks nicely,
|
||||
and add CDATA tags so writers do not have to use eg. <
|
||||
|
||||
The file "entities.xml" must be edited to reflect current
|
||||
version, year, etc.
|
||||
|
||||
|
||||
Usage:
|
||||
|
||||
./xmlproc.sh -v manual.xml
|
||||
Validates an xml file to ensure no dtd-compliance errors
|
||||
|
||||
./xmlproc.sh -html manual.xml
|
||||
Output: manual.html
|
||||
|
||||
./xmlproc.sh -pdf manual.xml
|
||||
Output: manual.pdf
|
||||
|
||||
./xmlproc.sh -ps manual.xml
|
||||
Output: manual.ps
|
||||
|
||||
|
||||
Notum bene:
|
||||
- pdfxmltex barfs if given a filename with an underscore in it
|
||||
|
||||
- xmltex won't work yet - there's a bug in passivetex
|
||||
which we are all waiting for Sebastian to fix.
|
||||
So we are going the xml -> pdf -> ps route for the time being,
|
||||
using pdfxmltex.
|
@ -8,8 +8,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
@ -202,9 +202,9 @@ void fallbackQSort3 ( UInt32* fmap,
|
||||
bhtab [ 0 .. 2+(nblock/32) ] destroyed
|
||||
*/
|
||||
|
||||
#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31))
|
||||
#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31))
|
||||
#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31)))
|
||||
#define SET_BH(zz) bhtab[(zz) >> 5] |= ((UInt32)1 << ((zz) & 31))
|
||||
#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~((UInt32)1 << ((zz) & 31))
|
||||
#define ISSET_BH(zz) (bhtab[(zz) >> 5] & ((UInt32)1 << ((zz) & 31)))
|
||||
#define WORD_BH(zz) bhtab[(zz) >> 5]
|
||||
#define UNALIGNED_BH(zz) ((zz) & 0x01f)
|
||||
|
||||
@ -274,7 +274,7 @@ void fallbackSort ( UInt32* fmap,
|
||||
r = -1;
|
||||
while (1) {
|
||||
|
||||
/*-- find the next non-singleton bucket --*/
|
||||
/*-- find the next non-singleton bucket --*/
|
||||
k = r + 1;
|
||||
while (ISSET_BH(k) && UNALIGNED_BH(k)) k++;
|
||||
if (ISSET_BH(k)) {
|
||||
|
@ -1,39 +0,0 @@
|
||||
<?xml version="1.0"?> <!-- -*- sgml -*- -->
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
|
||||
<!-- we like '1.2 Title' -->
|
||||
<xsl:param name="section.autolabel" select="'1'"/>
|
||||
<xsl:param name="section.label.includes.component.label" select="'1'"/>
|
||||
|
||||
<!-- Do not put 'Chapter' at the start of eg 'Chapter 1. Doing This' -->
|
||||
<xsl:param name="local.l10n.xml" select="document('')"/>
|
||||
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
|
||||
<l:l10n language="en">
|
||||
<l:context name="title-numbered">
|
||||
<l:template name="chapter" text="%n. %t"/>
|
||||
</l:context>
|
||||
</l:l10n>
|
||||
</l:i18n>
|
||||
|
||||
<!-- don't generate sub-tocs for qanda sets -->
|
||||
<xsl:param name="generate.toc">
|
||||
set toc,title
|
||||
book toc,title,figure,table,example,equation
|
||||
chapter toc,title
|
||||
section toc
|
||||
sect1 toc
|
||||
sect2 toc
|
||||
sect3 toc
|
||||
sect4 nop
|
||||
sect5 nop
|
||||
qandaset toc
|
||||
qandadiv nop
|
||||
appendix toc,title
|
||||
article/appendix nop
|
||||
article toc,title
|
||||
preface toc,title
|
||||
reference toc,title
|
||||
</xsl:param>
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,276 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- sgml -*- -->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
|
||||
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
|
||||
<xsl:import href="bz-common.xsl"/>
|
||||
|
||||
<!-- set indent = yes while debugging, then change to NO -->
|
||||
<xsl:output method="xml" indent="yes"/>
|
||||
|
||||
<!-- ensure only passivetex extensions are on -->
|
||||
<xsl:param name="stylesheet.result.type" select="'fo'"/>
|
||||
<!-- fo extensions: PDF bookmarks and index terms -->
|
||||
<xsl:param name="use.extensions" select="'1'"/>
|
||||
<xsl:param name="xep.extensions" select="0"/>
|
||||
<xsl:param name="fop.extensions" select="0"/>
|
||||
<xsl:param name="saxon.extensions" select="0"/>
|
||||
<xsl:param name="passivetex.extensions" select="1"/>
|
||||
<xsl:param name="tablecolumns.extension" select="'1'"/>
|
||||
|
||||
<!-- ensure we are using single sided -->
|
||||
<xsl:param name="double.sided" select="'0'"/>
|
||||
|
||||
<!-- insert cross references to page numbers -->
|
||||
<xsl:param name="insert.xref.page.number" select="1"/>
|
||||
|
||||
<!-- <?custom-pagebreak?> inserts a page break at this point -->
|
||||
<xsl:template match="processing-instruction('custom-pagebreak')">
|
||||
<fo:block break-before='page'/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- show links in color -->
|
||||
<xsl:attribute-set name="xref.properties">
|
||||
<xsl:attribute name="color">blue</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- make pre listings indented a bit + a bg colour -->
|
||||
<xsl:template match="programlisting | screen">
|
||||
<fo:block start-indent="0.25in" wrap-option="no-wrap"
|
||||
white-space-collapse="false" text-align="start"
|
||||
font-family="monospace" background-color="#f2f2f9"
|
||||
linefeed-treatment="preserve"
|
||||
xsl:use-attribute-sets="normal.para.spacing">
|
||||
<xsl:apply-templates/>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
<!-- make verbatim output prettier -->
|
||||
<xsl:template match="literallayout">
|
||||
<fo:block start-indent="0.25in" wrap-option="no-wrap"
|
||||
white-space-collapse="false" text-align="start"
|
||||
font-family="monospace" background-color="#edf7f4"
|
||||
linefeed-treatment="preserve"
|
||||
space-before="0em" space-after="0em">
|
||||
<xsl:apply-templates/>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<!-- workaround bug in passivetex fo output for itemizedlist -->
|
||||
<xsl:template match="itemizedlist/listitem">
|
||||
<xsl:variable name="id">
|
||||
<xsl:call-template name="object.id"/></xsl:variable>
|
||||
<xsl:variable name="itemsymbol">
|
||||
<xsl:call-template name="list.itemsymbol">
|
||||
<xsl:with-param name="node" select="parent::itemizedlist"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="item.contents">
|
||||
<fo:list-item-label end-indent="label-end()">
|
||||
<fo:block>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$itemsymbol='disc'">•</xsl:when>
|
||||
<xsl:when test="$itemsymbol='bullet'">•</xsl:when>
|
||||
<xsl:otherwise>•</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</fo:block>
|
||||
</fo:list-item-label>
|
||||
<fo:list-item-body start-indent="body-start()">
|
||||
<xsl:apply-templates/> <!-- removed extra block wrapper -->
|
||||
</fo:list-item-body>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="parent::*/@spacing = 'compact'">
|
||||
<fo:list-item id="{$id}"
|
||||
xsl:use-attribute-sets="compact.list.item.spacing">
|
||||
<xsl:copy-of select="$item.contents"/>
|
||||
</fo:list-item>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
|
||||
<xsl:copy-of select="$item.contents"/>
|
||||
</fo:list-item>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- workaround bug in passivetex fo output for orderedlist -->
|
||||
<xsl:template match="orderedlist/listitem">
|
||||
<xsl:variable name="id">
|
||||
<xsl:call-template name="object.id"/></xsl:variable>
|
||||
<xsl:variable name="item.contents">
|
||||
<fo:list-item-label end-indent="label-end()">
|
||||
<fo:block>
|
||||
<xsl:apply-templates select="." mode="item-number"/>
|
||||
</fo:block>
|
||||
</fo:list-item-label>
|
||||
<fo:list-item-body start-indent="body-start()">
|
||||
<xsl:apply-templates/> <!-- removed extra block wrapper -->
|
||||
</fo:list-item-body>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="parent::*/@spacing = 'compact'">
|
||||
<fo:list-item id="{$id}"
|
||||
xsl:use-attribute-sets="compact.list.item.spacing">
|
||||
<xsl:copy-of select="$item.contents"/>
|
||||
</fo:list-item>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
|
||||
<xsl:copy-of select="$item.contents"/>
|
||||
</fo:list-item>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- workaround bug in passivetex fo output for variablelist -->
|
||||
<xsl:param name="variablelist.as.blocks" select="1"/>
|
||||
<xsl:template match="varlistentry" mode="vl.as.blocks">
|
||||
<xsl:variable name="id">
|
||||
<xsl:call-template name="object.id"/></xsl:variable>
|
||||
<fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing"
|
||||
keep-together.within-column="always"
|
||||
keep-with-next.within-column="always">
|
||||
<xsl:apply-templates select="term"/>
|
||||
</fo:block>
|
||||
<fo:block start-indent="0.5in" end-indent="0in"
|
||||
space-after.minimum="0.2em"
|
||||
space-after.optimum="0.4em"
|
||||
space-after.maximum="0.6em">
|
||||
<fo:block>
|
||||
<xsl:apply-templates select="listitem"/>
|
||||
</fo:block>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- workaround bug in footers: force right-align w/two 80|30 cols -->
|
||||
<xsl:template name="footer.table">
|
||||
<xsl:param name="pageclass" select="''"/>
|
||||
<xsl:param name="sequence" select="''"/>
|
||||
<xsl:param name="gentext-key" select="''"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$pageclass = 'index'">
|
||||
<xsl:attribute name="margin-left">0pt</xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:variable name="candidate">
|
||||
<fo:table table-layout="fixed" width="100%">
|
||||
<fo:table-column column-number="1" column-width="80%"/>
|
||||
<fo:table-column column-number="2" column-width="20%"/>
|
||||
<fo:table-body>
|
||||
<fo:table-row height="14pt">
|
||||
<fo:table-cell text-align="left" display-align="after">
|
||||
<xsl:attribute name="relative-align">baseline</xsl:attribute>
|
||||
<fo:block>
|
||||
<fo:block> </fo:block><!-- empty cell -->
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell text-align="center" display-align="after">
|
||||
<xsl:attribute name="relative-align">baseline</xsl:attribute>
|
||||
<fo:block>
|
||||
<xsl:call-template name="footer.content">
|
||||
<xsl:with-param name="pageclass" select="$pageclass"/>
|
||||
<xsl:with-param name="sequence" select="$sequence"/>
|
||||
<xsl:with-param name="position" select="'center'"/>
|
||||
<xsl:with-param name="gentext-key" select="$gentext-key"/>
|
||||
</xsl:call-template>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
</xsl:variable>
|
||||
<!-- Really output a footer? -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$pageclass='titlepage' and $gentext-key='book'
|
||||
and $sequence='first'">
|
||||
<!-- no, book titlepages have no footers at all -->
|
||||
</xsl:when>
|
||||
<xsl:when test="$sequence = 'blank' and $footers.on.blank.pages = 0">
|
||||
<!-- no output -->
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:copy-of select="$candidate"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- fix bug in headers: force right-align w/two 40|60 cols -->
|
||||
<xsl:template name="header.table">
|
||||
<xsl:param name="pageclass" select="''"/>
|
||||
<xsl:param name="sequence" select="''"/>
|
||||
<xsl:param name="gentext-key" select="''"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$pageclass = 'index'">
|
||||
<xsl:attribute name="margin-left">0pt</xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
<xsl:variable name="candidate">
|
||||
<fo:table table-layout="fixed" width="100%">
|
||||
<xsl:call-template name="head.sep.rule">
|
||||
<xsl:with-param name="pageclass" select="$pageclass"/>
|
||||
<xsl:with-param name="sequence" select="$sequence"/>
|
||||
<xsl:with-param name="gentext-key" select="$gentext-key"/>
|
||||
</xsl:call-template>
|
||||
<fo:table-column column-number="1" column-width="40%"/>
|
||||
<fo:table-column column-number="2" column-width="60%"/>
|
||||
<fo:table-body>
|
||||
<fo:table-row height="14pt">
|
||||
<fo:table-cell text-align="left" display-align="before">
|
||||
<xsl:attribute name="relative-align">baseline</xsl:attribute>
|
||||
<fo:block>
|
||||
<fo:block> </fo:block><!-- empty cell -->
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell text-align="center" display-align="before">
|
||||
<xsl:attribute name="relative-align">baseline</xsl:attribute>
|
||||
<fo:block>
|
||||
<xsl:call-template name="header.content">
|
||||
<xsl:with-param name="pageclass" select="$pageclass"/>
|
||||
<xsl:with-param name="sequence" select="$sequence"/>
|
||||
<xsl:with-param name="position" select="'center'"/>
|
||||
<xsl:with-param name="gentext-key" select="$gentext-key"/>
|
||||
</xsl:call-template>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
</xsl:variable>
|
||||
<!-- Really output a header? -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$pageclass = 'titlepage' and $gentext-key = 'book'
|
||||
and $sequence='first'">
|
||||
<!-- no, book titlepages have no headers at all -->
|
||||
</xsl:when>
|
||||
<xsl:when test="$sequence = 'blank' and $headers.on.blank.pages = 0">
|
||||
<!-- no output -->
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:copy-of select="$candidate"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Bug-fix for Suse 10 PassiveTex version -->
|
||||
<!-- Precompute attribute values 'cos PassiveTex is too stupid: -->
|
||||
<xsl:attribute-set name="component.title.properties">
|
||||
<xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
|
||||
<xsl:attribute name="space-before.optimum">
|
||||
<xsl:value-of select="concat($body.font.master, 'pt')"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">
|
||||
<xsl:value-of select="$body.font.master * 0.8"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">
|
||||
<xsl:value-of select="$body.font.master * 1.2"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="hyphenate">false</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0"?> <!-- -*- sgml -*- -->
|
||||
<!DOCTYPE xsl:stylesheet [ <!ENTITY bz-css SYSTEM "./bzip.css"> ]>
|
||||
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
|
||||
<xsl:import href="bz-common.xsl"/>
|
||||
|
||||
<!-- use 8859-1 encoding -->
|
||||
<xsl:output method="html" encoding="ISO-8859-1" indent="yes"/>
|
||||
|
||||
<!-- we include the css directly when generating one large file -->
|
||||
<xsl:template name="user.head.content">
|
||||
<style type="text/css" media="screen">
|
||||
<xsl:text>&bz-css;</xsl:text>
|
||||
</style>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,76 +0,0 @@
|
||||
#!/bin/sh
|
||||
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
|
||||
|
||||
# Bzcmp/diff wrapped for bzip2,
|
||||
# adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
|
||||
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-
|
||||
# gram on compressed files. All options specified are passed
|
||||
# directly to cmp or diff. If only 1 file is specified, then
|
||||
# the files compared are file1 and an uncompressed file1.gz.
|
||||
# If two files are specified, then they are uncompressed (if
|
||||
# necessary) and fed to cmp or diff. The exit status from cmp
|
||||
# or diff is preserved.
|
||||
|
||||
PATH="/usr/bin:/bin:$PATH"; export PATH
|
||||
prog=`echo $0 | sed 's|.*/||'`
|
||||
case "$prog" in
|
||||
*cmp) comp=${CMP-cmp} ;;
|
||||
*) comp=${DIFF-diff} ;;
|
||||
esac
|
||||
|
||||
OPTIONS=
|
||||
FILES=
|
||||
for ARG
|
||||
do
|
||||
case "$ARG" in
|
||||
-*) OPTIONS="$OPTIONS $ARG";;
|
||||
*) if test -f "$ARG"; then
|
||||
FILES="$FILES $ARG"
|
||||
else
|
||||
echo "${prog}: $ARG not found or not a regular file"
|
||||
exit 1
|
||||
fi ;;
|
||||
esac
|
||||
done
|
||||
if test -z "$FILES"; then
|
||||
echo "Usage: $prog [${comp}_options] file [file]"
|
||||
exit 1
|
||||
fi
|
||||
tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || {
|
||||
echo 'cannot create a temporary file' >&2
|
||||
exit 1
|
||||
}
|
||||
set $FILES
|
||||
if test $# -eq 1; then
|
||||
FILE=`echo "$1" | sed 's/.bz2$//'`
|
||||
bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
|
||||
STAT="$?"
|
||||
|
||||
elif test $# -eq 2; then
|
||||
case "$1" in
|
||||
*.bz2)
|
||||
case "$2" in
|
||||
*.bz2)
|
||||
F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
|
||||
bzip2 -cdfq "$2" > $tmp
|
||||
bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp
|
||||
STAT="$?"
|
||||
/bin/rm -f $tmp;;
|
||||
|
||||
*) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
|
||||
STAT="$?";;
|
||||
esac;;
|
||||
*) case "$2" in
|
||||
*.bz2)
|
||||
bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
|
||||
STAT="$?";;
|
||||
*) $comp $OPTIONS "$1" "$2"
|
||||
STAT="$?";;
|
||||
esac;;
|
||||
esac
|
||||
exit "$STAT"
|
||||
else
|
||||
echo "Usage: $prog [${comp}_options] file [file]"
|
||||
exit 1
|
||||
fi
|
@ -1,47 +0,0 @@
|
||||
\"Shamelessly copied from zmore.1 by Philippe Troin <phil@fifi.org>
|
||||
\"for Debian GNU/Linux
|
||||
.TH BZDIFF 1
|
||||
.SH NAME
|
||||
bzcmp, bzdiff \- compare bzip2 compressed files
|
||||
.SH SYNOPSIS
|
||||
.B bzcmp
|
||||
[ cmp_options ] file1
|
||||
[ file2 ]
|
||||
.br
|
||||
.B bzdiff
|
||||
[ diff_options ] file1
|
||||
[ file2 ]
|
||||
.SH DESCRIPTION
|
||||
.I Bzcmp
|
||||
and
|
||||
.I bzdiff
|
||||
are used to invoke the
|
||||
.I cmp
|
||||
or the
|
||||
.I diff
|
||||
program on bzip2 compressed files. All options specified are passed
|
||||
directly to
|
||||
.I cmp
|
||||
or
|
||||
.IR diff "."
|
||||
If only 1 file is specified, then the files compared are
|
||||
.I file1
|
||||
and an uncompressed
|
||||
.IR file1 ".bz2."
|
||||
If two files are specified, then they are uncompressed if necessary and fed to
|
||||
.I cmp
|
||||
or
|
||||
.IR diff "."
|
||||
The exit status from
|
||||
.I cmp
|
||||
or
|
||||
.I diff
|
||||
is preserved.
|
||||
.SH "SEE ALSO"
|
||||
cmp(1), diff(1), bzmore(1), bzless(1), bzgrep(1), bzip2(1)
|
||||
.SH BUGS
|
||||
Messages from the
|
||||
.I cmp
|
||||
or
|
||||
.I diff
|
||||
programs refer to temporary filenames instead of those specified.
|
@ -1,75 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Bzgrep wrapped for bzip2,
|
||||
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
## zgrep notice:
|
||||
## zgrep -- a wrapper around a grep program that decompresses files as needed
|
||||
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
||||
|
||||
PATH="/usr/bin:$PATH"; export PATH
|
||||
|
||||
prog=`echo $0 | sed 's|.*/||'`
|
||||
case "$prog" in
|
||||
*egrep) grep=${EGREP-egrep} ;;
|
||||
*fgrep) grep=${FGREP-fgrep} ;;
|
||||
*) grep=${GREP-grep} ;;
|
||||
esac
|
||||
pat=""
|
||||
while test $# -ne 0; do
|
||||
case "$1" in
|
||||
-e | -f) opt="$opt $1"; shift; pat="$1"
|
||||
if test "$grep" = grep; then # grep is buggy with -e on SVR4
|
||||
grep=egrep
|
||||
fi;;
|
||||
-A | -B) opt="$opt $1 $2"; shift;;
|
||||
-*) opt="$opt $1";;
|
||||
*) if test -z "$pat"; then
|
||||
pat="$1"
|
||||
else
|
||||
break;
|
||||
fi;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$pat"; then
|
||||
echo "grep through bzip2 files"
|
||||
echo "usage: $prog [grep_options] pattern [files]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
list=0
|
||||
silent=0
|
||||
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
||||
case "$op" in
|
||||
*l*) list=1
|
||||
esac
|
||||
case "$op" in
|
||||
*h*) silent=1
|
||||
esac
|
||||
|
||||
if test $# -eq 0; then
|
||||
bzip2 -cdfq | $grep $opt "$pat"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
res=0
|
||||
for i do
|
||||
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
|
||||
if test $list -eq 1; then
|
||||
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
|
||||
r=$?
|
||||
elif test $# -eq 1 -o $silent -eq 1; then
|
||||
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
||||
r=$?
|
||||
else
|
||||
j=${i//\\/\\\\}
|
||||
j=${j//|/\\|}
|
||||
j=${j//&/\\&}
|
||||
j=`printf "%s" "$j" | tr '\n' ' '`
|
||||
bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
||||
r=$?
|
||||
fi
|
||||
test "$r" -ne 0 && res="$r"
|
||||
done
|
||||
exit $res
|
@ -1,56 +0,0 @@
|
||||
\"Shamelessly copied from zmore.1 by Philippe Troin <phil@fifi.org>
|
||||
\"for Debian GNU/Linux
|
||||
.TH BZGREP 1
|
||||
.SH NAME
|
||||
bzgrep, bzfgrep, bzegrep \- search possibly bzip2 compressed files for a regular expression
|
||||
.SH SYNOPSIS
|
||||
.B bzgrep
|
||||
[ grep_options ]
|
||||
.BI [\ -e\ ] " pattern"
|
||||
.IR filename ".\|.\|."
|
||||
.br
|
||||
.B bzegrep
|
||||
[ egrep_options ]
|
||||
.BI [\ -e\ ] " pattern"
|
||||
.IR filename ".\|.\|."
|
||||
.br
|
||||
.B bzfgrep
|
||||
[ fgrep_options ]
|
||||
.BI [\ -e\ ] " pattern"
|
||||
.IR filename ".\|.\|."
|
||||
.SH DESCRIPTION
|
||||
.IR Bzgrep
|
||||
is used to invoke the
|
||||
.I grep
|
||||
on bzip2-compressed files. All options specified are passed directly to
|
||||
.I grep.
|
||||
If no file is specified, then the standard input is decompressed
|
||||
if necessary and fed to grep.
|
||||
Otherwise the given files are uncompressed if necessary and fed to
|
||||
.I grep.
|
||||
.PP
|
||||
If
|
||||
.I bzgrep
|
||||
is invoked as
|
||||
.I bzegrep
|
||||
or
|
||||
.I bzfgrep
|
||||
then
|
||||
.I egrep
|
||||
or
|
||||
.I fgrep
|
||||
is used instead of
|
||||
.I grep.
|
||||
If the GREP environment variable is set,
|
||||
.I bzgrep
|
||||
uses it as the
|
||||
.I grep
|
||||
program to be invoked. For example:
|
||||
|
||||
for sh: GREP=fgrep bzgrep string files
|
||||
for csh: (setenv GREP fgrep; bzgrep string files)
|
||||
.SH AUTHOR
|
||||
Charles Levert (charles@comm.polymtl.ca). Adapted to bzip2 by Philippe
|
||||
Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
.SH "SEE ALSO"
|
||||
grep(1), egrep(1), fgrep(1), bzdiff(1), bzmore(1), bzless(1), bzip2(1)
|
@ -1,74 +0,0 @@
|
||||
/* Colours:
|
||||
#74240f dark brown h1, h2, h3, h4
|
||||
#336699 medium blue links
|
||||
#339999 turquoise link hover colour
|
||||
#202020 almost black general text
|
||||
#761596 purple md5sum text
|
||||
#626262 dark gray pre border
|
||||
#eeeeee very light gray pre background
|
||||
#f2f2f9 very light blue nav table background
|
||||
#3366cc medium blue nav table border
|
||||
*/
|
||||
|
||||
a, a:link, a:visited, a:active { color: #336699; }
|
||||
a:hover { color: #339999; }
|
||||
|
||||
body { font: 80%/126% sans-serif; }
|
||||
h1, h2, h3, h4 { color: #74240f; }
|
||||
|
||||
dt { color: #336699; font-weight: bold }
|
||||
dd {
|
||||
margin-left: 1.5em;
|
||||
padding-bottom: 0.8em;
|
||||
}
|
||||
|
||||
/* -- ruler -- */
|
||||
div.hr_blue {
|
||||
height: 3px;
|
||||
background:#ffffff url("/images/hr_blue.png") repeat-x; }
|
||||
div.hr_blue hr { display:none; }
|
||||
|
||||
/* release styles */
|
||||
#release p { margin-top: 0.4em; }
|
||||
#release .md5sum { color: #761596; }
|
||||
|
||||
|
||||
/* ------ styles for docs|manuals|howto ------ */
|
||||
/* -- lists -- */
|
||||
ul {
|
||||
margin: 0px 4px 16px 16px;
|
||||
padding: 0px;
|
||||
list-style: url("/images/li-blue.png");
|
||||
}
|
||||
ul li {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
ul ul {
|
||||
list-style-type: none;
|
||||
list-style-image: none;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
/* header / footer nav tables */
|
||||
table.nav {
|
||||
border: solid 1px #3366cc;
|
||||
background: #f2f2f9;
|
||||
background-color: #f2f2f9;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
/* don't have underlined links in chunked nav menus */
|
||||
table.nav a { text-decoration: none; }
|
||||
table.nav a:hover { text-decoration: underline; }
|
||||
table.nav td { font-size: 85%; }
|
||||
|
||||
code, tt, pre { font-size: 120%; }
|
||||
code, tt { color: #761596; }
|
||||
|
||||
div.literallayout, pre.programlisting, pre.screen {
|
||||
color: #000000;
|
||||
padding: 0.5em;
|
||||
background: #eeeeee;
|
||||
border: 1px solid #626262;
|
||||
background-color: #eeeeee;
|
||||
margin: 4px 0px 4px 0px;
|
||||
}
|
@ -1,454 +0,0 @@
|
||||
.PU
|
||||
.TH bzip2 1
|
||||
.SH NAME
|
||||
bzip2, bunzip2 \- a block-sorting file compressor, v1.0.4
|
||||
.br
|
||||
bzcat \- decompresses files to stdout
|
||||
.br
|
||||
bzip2recover \- recovers data from damaged bzip2 files
|
||||
|
||||
.SH SYNOPSIS
|
||||
.ll +8
|
||||
.B bzip2
|
||||
.RB [ " \-cdfkqstvzVL123456789 " ]
|
||||
[
|
||||
.I "filenames \&..."
|
||||
]
|
||||
.ll -8
|
||||
.br
|
||||
.B bunzip2
|
||||
.RB [ " \-fkvsVL " ]
|
||||
[
|
||||
.I "filenames \&..."
|
||||
]
|
||||
.br
|
||||
.B bzcat
|
||||
.RB [ " \-s " ]
|
||||
[
|
||||
.I "filenames \&..."
|
||||
]
|
||||
.br
|
||||
.B bzip2recover
|
||||
.I "filename"
|
||||
|
||||
.SH DESCRIPTION
|
||||
.I bzip2
|
||||
compresses files using the Burrows-Wheeler block sorting
|
||||
text compression algorithm, and Huffman coding. Compression is
|
||||
generally considerably better than that achieved by more conventional
|
||||
LZ77/LZ78-based compressors, and approaches the performance of the PPM
|
||||
family of statistical compressors.
|
||||
|
||||
The command-line options are deliberately very similar to
|
||||
those of
|
||||
.I GNU gzip,
|
||||
but they are not identical.
|
||||
|
||||
.I bzip2
|
||||
expects a list of file names to accompany the
|
||||
command-line flags. Each file is replaced by a compressed version of
|
||||
itself, with the name "original_name.bz2".
|
||||
Each compressed file
|
||||
has the same modification date, permissions, and, when possible,
|
||||
ownership as the corresponding original, so that these properties can
|
||||
be correctly restored at decompression time. File name handling is
|
||||
naive in the sense that there is no mechanism for preserving original
|
||||
file names, permissions, ownerships or dates in filesystems which lack
|
||||
these concepts, or have serious file name length restrictions, such as
|
||||
MS-DOS.
|
||||
|
||||
.I bzip2
|
||||
and
|
||||
.I bunzip2
|
||||
will by default not overwrite existing
|
||||
files. If you want this to happen, specify the \-f flag.
|
||||
|
||||
If no file names are specified,
|
||||
.I bzip2
|
||||
compresses from standard
|
||||
input to standard output. In this case,
|
||||
.I bzip2
|
||||
will decline to
|
||||
write compressed output to a terminal, as this would be entirely
|
||||
incomprehensible and therefore pointless.
|
||||
|
||||
.I bunzip2
|
||||
(or
|
||||
.I bzip2 \-d)
|
||||
decompresses all
|
||||
specified files. Files which were not created by
|
||||
.I bzip2
|
||||
will be detected and ignored, and a warning issued.
|
||||
.I bzip2
|
||||
attempts to guess the filename for the decompressed file
|
||||
from that of the compressed file as follows:
|
||||
|
||||
filename.bz2 becomes filename
|
||||
filename.bz becomes filename
|
||||
filename.tbz2 becomes filename.tar
|
||||
filename.tbz becomes filename.tar
|
||||
anyothername becomes anyothername.out
|
||||
|
||||
If the file does not end in one of the recognised endings,
|
||||
.I .bz2,
|
||||
.I .bz,
|
||||
.I .tbz2
|
||||
or
|
||||
.I .tbz,
|
||||
.I bzip2
|
||||
complains that it cannot
|
||||
guess the name of the original file, and uses the original name
|
||||
with
|
||||
.I .out
|
||||
appended.
|
||||
|
||||
As with compression, supplying no
|
||||
filenames causes decompression from
|
||||
standard input to standard output.
|
||||
|
||||
.I bunzip2
|
||||
will correctly decompress a file which is the
|
||||
concatenation of two or more compressed files. The result is the
|
||||
concatenation of the corresponding uncompressed files. Integrity
|
||||
testing (\-t)
|
||||
of concatenated
|
||||
compressed files is also supported.
|
||||
|
||||
You can also compress or decompress files to the standard output by
|
||||
giving the \-c flag. Multiple files may be compressed and
|
||||
decompressed like this. The resulting outputs are fed sequentially to
|
||||
stdout. Compression of multiple files
|
||||
in this manner generates a stream
|
||||
containing multiple compressed file representations. Such a stream
|
||||
can be decompressed correctly only by
|
||||
.I bzip2
|
||||
version 0.9.0 or
|
||||
later. Earlier versions of
|
||||
.I bzip2
|
||||
will stop after decompressing
|
||||
the first file in the stream.
|
||||
|
||||
.I bzcat
|
||||
(or
|
||||
.I bzip2 -dc)
|
||||
decompresses all specified files to
|
||||
the standard output.
|
||||
|
||||
.I bzip2
|
||||
will read arguments from the environment variables
|
||||
.I BZIP2
|
||||
and
|
||||
.I BZIP,
|
||||
in that order, and will process them
|
||||
before any arguments read from the command line. This gives a
|
||||
convenient way to supply default arguments.
|
||||
|
||||
Compression is always performed, even if the compressed
|
||||
file is slightly
|
||||
larger than the original. Files of less than about one hundred bytes
|
||||
tend to get larger, since the compression mechanism has a constant
|
||||
overhead in the region of 50 bytes. Random data (including the output
|
||||
of most file compressors) is coded at about 8.05 bits per byte, giving
|
||||
an expansion of around 0.5%.
|
||||
|
||||
As a self-check for your protection,
|
||||
.I
|
||||
bzip2
|
||||
uses 32-bit CRCs to
|
||||
make sure that the decompressed version of a file is identical to the
|
||||
original. This guards against corruption of the compressed data, and
|
||||
against undetected bugs in
|
||||
.I bzip2
|
||||
(hopefully very unlikely). The
|
||||
chances of data corruption going undetected is microscopic, about one
|
||||
chance in four billion for each file processed. Be aware, though, that
|
||||
the check occurs upon decompression, so it can only tell you that
|
||||
something is wrong. It can't help you
|
||||
recover the original uncompressed
|
||||
data. You can use
|
||||
.I bzip2recover
|
||||
to try to recover data from
|
||||
damaged files.
|
||||
|
||||
Return values: 0 for a normal exit, 1 for environmental problems (file
|
||||
not found, invalid flags, I/O errors, &c), 2 to indicate a corrupt
|
||||
compressed file, 3 for an internal consistency error (eg, bug) which
|
||||
caused
|
||||
.I bzip2
|
||||
to panic.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-c --stdout
|
||||
Compress or decompress to standard output.
|
||||
.TP
|
||||
.B \-d --decompress
|
||||
Force decompression.
|
||||
.I bzip2,
|
||||
.I bunzip2
|
||||
and
|
||||
.I bzcat
|
||||
are
|
||||
really the same program, and the decision about what actions to take is
|
||||
done on the basis of which name is used. This flag overrides that
|
||||
mechanism, and forces
|
||||
.I bzip2
|
||||
to decompress.
|
||||
.TP
|
||||
.B \-z --compress
|
||||
The complement to \-d: forces compression, regardless of the
|
||||
invocation name.
|
||||
.TP
|
||||
.B \-t --test
|
||||
Check integrity of the specified file(s), but don't decompress them.
|
||||
This really performs a trial decompression and throws away the result.
|
||||
.TP
|
||||
.B \-f --force
|
||||
Force overwrite of output files. Normally,
|
||||
.I bzip2
|
||||
will not overwrite
|
||||
existing output files. Also forces
|
||||
.I bzip2
|
||||
to break hard links
|
||||
to files, which it otherwise wouldn't do.
|
||||
|
||||
bzip2 normally declines to decompress files which don't have the
|
||||
correct magic header bytes. If forced (-f), however, it will pass
|
||||
such files through unmodified. This is how GNU gzip behaves.
|
||||
.TP
|
||||
.B \-k --keep
|
||||
Keep (don't delete) input files during compression
|
||||
or decompression.
|
||||
.TP
|
||||
.B \-s --small
|
||||
Reduce memory usage, for compression, decompression and testing. Files
|
||||
are decompressed and tested using a modified algorithm which only
|
||||
requires 2.5 bytes per block byte. This means any file can be
|
||||
decompressed in 2300k of memory, albeit at about half the normal speed.
|
||||
|
||||
During compression, \-s selects a block size of 200k, which limits
|
||||
memory use to around the same figure, at the expense of your compression
|
||||
ratio. In short, if your machine is low on memory (8 megabytes or
|
||||
less), use \-s for everything. See MEMORY MANAGEMENT below.
|
||||
.TP
|
||||
.B \-q --quiet
|
||||
Suppress non-essential warning messages. Messages pertaining to
|
||||
I/O errors and other critical events will not be suppressed.
|
||||
.TP
|
||||
.B \-v --verbose
|
||||
Verbose mode -- show the compression ratio for each file processed.
|
||||
Further \-v's increase the verbosity level, spewing out lots of
|
||||
information which is primarily of interest for diagnostic purposes.
|
||||
.TP
|
||||
.B \-L --license -V --version
|
||||
Display the software version, license terms and conditions.
|
||||
.TP
|
||||
.B \-1 (or \-\-fast) to \-9 (or \-\-best)
|
||||
Set the block size to 100 k, 200 k .. 900 k when compressing. Has no
|
||||
effect when decompressing. See MEMORY MANAGEMENT below.
|
||||
The \-\-fast and \-\-best aliases are primarily for GNU gzip
|
||||
compatibility. In particular, \-\-fast doesn't make things
|
||||
significantly faster.
|
||||
And \-\-best merely selects the default behaviour.
|
||||
.TP
|
||||
.B \--
|
||||
Treats all subsequent arguments as file names, even if they start
|
||||
with a dash. This is so you can handle files with names beginning
|
||||
with a dash, for example: bzip2 \-- \-myfilename.
|
||||
.TP
|
||||
.B \--repetitive-fast --repetitive-best
|
||||
These flags are redundant in versions 0.9.5 and above. They provided
|
||||
some coarse control over the behaviour of the sorting algorithm in
|
||||
earlier versions, which was sometimes useful. 0.9.5 and above have an
|
||||
improved algorithm which renders these flags irrelevant.
|
||||
|
||||
.SH MEMORY MANAGEMENT
|
||||
.I bzip2
|
||||
compresses large files in blocks. The block size affects
|
||||
both the compression ratio achieved, and the amount of memory needed for
|
||||
compression and decompression. The flags \-1 through \-9
|
||||
specify the block size to be 100,000 bytes through 900,000 bytes (the
|
||||
default) respectively. At decompression time, the block size used for
|
||||
compression is read from the header of the compressed file, and
|
||||
.I bunzip2
|
||||
then allocates itself just enough memory to decompress
|
||||
the file. Since block sizes are stored in compressed files, it follows
|
||||
that the flags \-1 to \-9 are irrelevant to and so ignored
|
||||
during decompression.
|
||||
|
||||
Compression and decompression requirements,
|
||||
in bytes, can be estimated as:
|
||||
|
||||
Compression: 400k + ( 8 x block size )
|
||||
|
||||
Decompression: 100k + ( 4 x block size ), or
|
||||
100k + ( 2.5 x block size )
|
||||
|
||||
Larger block sizes give rapidly diminishing marginal returns. Most of
|
||||
the compression comes from the first two or three hundred k of block
|
||||
size, a fact worth bearing in mind when using
|
||||
.I bzip2
|
||||
on small machines.
|
||||
It is also important to appreciate that the decompression memory
|
||||
requirement is set at compression time by the choice of block size.
|
||||
|
||||
For files compressed with the default 900k block size,
|
||||
.I bunzip2
|
||||
will require about 3700 kbytes to decompress. To support decompression
|
||||
of any file on a 4 megabyte machine,
|
||||
.I bunzip2
|
||||
has an option to
|
||||
decompress using approximately half this amount of memory, about 2300
|
||||
kbytes. Decompression speed is also halved, so you should use this
|
||||
option only where necessary. The relevant flag is -s.
|
||||
|
||||
In general, try and use the largest block size memory constraints allow,
|
||||
since that maximises the compression achieved. Compression and
|
||||
decompression speed are virtually unaffected by block size.
|
||||
|
||||
Another significant point applies to files which fit in a single block
|
||||
-- that means most files you'd encounter using a large block size. The
|
||||
amount of real memory touched is proportional to the size of the file,
|
||||
since the file is smaller than a block. For example, compressing a file
|
||||
20,000 bytes long with the flag -9 will cause the compressor to
|
||||
allocate around 7600k of memory, but only touch 400k + 20000 * 8 = 560
|
||||
kbytes of it. Similarly, the decompressor will allocate 3700k but only
|
||||
touch 100k + 20000 * 4 = 180 kbytes.
|
||||
|
||||
Here is a table which summarises the maximum memory usage for different
|
||||
block sizes. Also recorded is the total compressed size for 14 files of
|
||||
the Calgary Text Compression Corpus totalling 3,141,622 bytes. This
|
||||
column gives some feel for how compression varies with block size.
|
||||
These figures tend to understate the advantage of larger block sizes for
|
||||
larger files, since the Corpus is dominated by smaller files.
|
||||
|
||||
Compress Decompress Decompress Corpus
|
||||
Flag usage usage -s usage Size
|
||||
|
||||
-1 1200k 500k 350k 914704
|
||||
-2 2000k 900k 600k 877703
|
||||
-3 2800k 1300k 850k 860338
|
||||
-4 3600k 1700k 1100k 846899
|
||||
-5 4400k 2100k 1350k 845160
|
||||
-6 5200k 2500k 1600k 838626
|
||||
-7 6100k 2900k 1850k 834096
|
||||
-8 6800k 3300k 2100k 828642
|
||||
-9 7600k 3700k 2350k 828642
|
||||
|
||||
.SH RECOVERING DATA FROM DAMAGED FILES
|
||||
.I bzip2
|
||||
compresses files in blocks, usually 900kbytes long. Each
|
||||
block is handled independently. If a media or transmission error causes
|
||||
a multi-block .bz2
|
||||
file to become damaged, it may be possible to
|
||||
recover data from the undamaged blocks in the file.
|
||||
|
||||
The compressed representation of each block is delimited by a 48-bit
|
||||
pattern, which makes it possible to find the block boundaries with
|
||||
reasonable certainty. Each block also carries its own 32-bit CRC, so
|
||||
damaged blocks can be distinguished from undamaged ones.
|
||||
|
||||
.I bzip2recover
|
||||
is a simple program whose purpose is to search for
|
||||
blocks in .bz2 files, and write each block out into its own .bz2
|
||||
file. You can then use
|
||||
.I bzip2
|
||||
\-t
|
||||
to test the
|
||||
integrity of the resulting files, and decompress those which are
|
||||
undamaged.
|
||||
|
||||
.I bzip2recover
|
||||
takes a single argument, the name of the damaged file,
|
||||
and writes a number of files "rec00001file.bz2",
|
||||
"rec00002file.bz2", etc, containing the extracted blocks.
|
||||
The output filenames are designed so that the use of
|
||||
wildcards in subsequent processing -- for example,
|
||||
"bzip2 -dc rec*file.bz2 > recovered_data" -- processes the files in
|
||||
the correct order.
|
||||
|
||||
.I bzip2recover
|
||||
should be of most use dealing with large .bz2
|
||||
files, as these will contain many blocks. It is clearly
|
||||
futile to use it on damaged single-block files, since a
|
||||
damaged block cannot be recovered. If you wish to minimise
|
||||
any potential data loss through media or transmission errors,
|
||||
you might consider compressing with a smaller
|
||||
block size.
|
||||
|
||||
.SH PERFORMANCE NOTES
|
||||
The sorting phase of compression gathers together similar strings in the
|
||||
file. Because of this, files containing very long runs of repeated
|
||||
symbols, like "aabaabaabaab ..." (repeated several hundred times) may
|
||||
compress more slowly than normal. Versions 0.9.5 and above fare much
|
||||
better than previous versions in this respect. The ratio between
|
||||
worst-case and average-case compression time is in the region of 10:1.
|
||||
For previous versions, this figure was more like 100:1. You can use the
|
||||
\-vvvv option to monitor progress in great detail, if you want.
|
||||
|
||||
Decompression speed is unaffected by these phenomena.
|
||||
|
||||
.I bzip2
|
||||
usually allocates several megabytes of memory to operate
|
||||
in, and then charges all over it in a fairly random fashion. This means
|
||||
that performance, both for compressing and decompressing, is largely
|
||||
determined by the speed at which your machine can service cache misses.
|
||||
Because of this, small changes to the code to reduce the miss rate have
|
||||
been observed to give disproportionately large performance improvements.
|
||||
I imagine
|
||||
.I bzip2
|
||||
will perform best on machines with very large caches.
|
||||
|
||||
.SH CAVEATS
|
||||
I/O error messages are not as helpful as they could be.
|
||||
.I bzip2
|
||||
tries hard to detect I/O errors and exit cleanly, but the details of
|
||||
what the problem is sometimes seem rather misleading.
|
||||
|
||||
This manual page pertains to version 1.0.4 of
|
||||
.I bzip2.
|
||||
Compressed data created by this version is entirely forwards and
|
||||
backwards compatible with the previous public releases, versions
|
||||
0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and 1.0.3, but with the following
|
||||
exception: 0.9.0 and above can correctly decompress multiple
|
||||
concatenated compressed files. 0.1pl2 cannot do this; it will stop
|
||||
after decompressing just the first file in the stream.
|
||||
|
||||
.I bzip2recover
|
||||
versions prior to 1.0.2 used 32-bit integers to represent
|
||||
bit positions in compressed files, so they could not handle compressed
|
||||
files more than 512 megabytes long. Versions 1.0.2 and above use
|
||||
64-bit ints on some platforms which support them (GNU supported
|
||||
targets, and Windows). To establish whether or not bzip2recover was
|
||||
built with such a limitation, run it without arguments. In any event
|
||||
you can build yourself an unlimited version if you can recompile it
|
||||
with MaybeUInt64 set to be an unsigned 64-bit integer.
|
||||
|
||||
|
||||
|
||||
.SH AUTHOR
|
||||
Julian Seward, jsewardbzip.org.
|
||||
|
||||
http://www.bzip.org
|
||||
|
||||
The ideas embodied in
|
||||
.I bzip2
|
||||
are due to (at least) the following
|
||||
people: Michael Burrows and David Wheeler (for the block sorting
|
||||
transformation), David Wheeler (again, for the Huffman coder), Peter
|
||||
Fenwick (for the structured coding model in the original
|
||||
.I bzip,
|
||||
and many refinements), and Alistair Moffat, Radford Neal and Ian Witten
|
||||
(for the arithmetic coder in the original
|
||||
.I bzip).
|
||||
I am much
|
||||
indebted for their help, support and advice. See the manual in the
|
||||
source distribution for pointers to sources of documentation. Christian
|
||||
von Roques encouraged me to look for faster sorting algorithms, so as to
|
||||
speed up compression. Bela Lubkin encouraged me to improve the
|
||||
worst-case compression performance.
|
||||
Donna Robinson XMLised the documentation.
|
||||
The bz* scripts are derived from those of GNU gzip.
|
||||
Many people sent patches, helped
|
||||
with portability problems, lent machines, gave advice and were generally
|
||||
helpful.
|
@ -1,399 +0,0 @@
|
||||
bzip2(1) bzip2(1)
|
||||
|
||||
|
||||
|
||||
NNAAMMEE
|
||||
bzip2, bunzip2 − a block‐sorting file compressor, v1.0.4
|
||||
bzcat − decompresses files to stdout
|
||||
bzip2recover − recovers data from damaged bzip2 files
|
||||
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
bbzziipp22 [ −−ccddffkkqqssttvvzzVVLL112233445566778899 ] [ _f_i_l_e_n_a_m_e_s _._._. ]
|
||||
bbuunnzziipp22 [ −−ffkkvvssVVLL ] [ _f_i_l_e_n_a_m_e_s _._._. ]
|
||||
bbzzccaatt [ −−ss ] [ _f_i_l_e_n_a_m_e_s _._._. ]
|
||||
bbzziipp22rreeccoovveerr _f_i_l_e_n_a_m_e
|
||||
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
_b_z_i_p_2 compresses files using the Burrows‐Wheeler block
|
||||
sorting text compression algorithm, and Huffman coding.
|
||||
Compression is generally considerably better than that
|
||||
achieved by more conventional LZ77/LZ78‐based compressors,
|
||||
and approaches the performance of the PPM family of sta
|
||||
tistical compressors.
|
||||
|
||||
The command‐line options are deliberately very similar to
|
||||
those of _G_N_U _g_z_i_p_, but they are not identical.
|
||||
|
||||
_b_z_i_p_2 expects a list of file names to accompany the com
|
||||
mand‐line flags. Each file is replaced by a compressed
|
||||
version of itself, with the name "original_name.bz2".
|
||||
Each compressed file has the same modification date, per
|
||||
missions, and, when possible, ownership as the correspond
|
||||
ing original, so that these properties can be correctly
|
||||
restored at decompression time. File name handling is
|
||||
naive in the sense that there is no mechanism for preserv
|
||||
ing original file names, permissions, ownerships or dates
|
||||
in filesystems which lack these concepts, or have serious
|
||||
file name length restrictions, such as MS‐DOS.
|
||||
|
||||
_b_z_i_p_2 and _b_u_n_z_i_p_2 will by default not overwrite existing
|
||||
files. If you want this to happen, specify the −f flag.
|
||||
|
||||
If no file names are specified, _b_z_i_p_2 compresses from
|
||||
standard input to standard output. In this case, _b_z_i_p_2
|
||||
will decline to write compressed output to a terminal, as
|
||||
this would be entirely incomprehensible and therefore
|
||||
pointless.
|
||||
|
||||
_b_u_n_z_i_p_2 (or _b_z_i_p_2 _−_d_) decompresses all specified files.
|
||||
Files which were not created by _b_z_i_p_2 will be detected and
|
||||
ignored, and a warning issued. _b_z_i_p_2 attempts to guess
|
||||
the filename for the decompressed file from that of the
|
||||
compressed file as follows:
|
||||
|
||||
filename.bz2 becomes filename
|
||||
filename.bz becomes filename
|
||||
filename.tbz2 becomes filename.tar
|
||||
filename.tbz becomes filename.tar
|
||||
anyothername becomes anyothername.out
|
||||
|
||||
If the file does not end in one of the recognised endings,
|
||||
_._b_z_2_, _._b_z_, _._t_b_z_2 or _._t_b_z_, _b_z_i_p_2 complains that it cannot
|
||||
guess the name of the original file, and uses the original
|
||||
name with _._o_u_t appended.
|
||||
|
||||
As with compression, supplying no filenames causes decom
|
||||
pression from standard input to standard output.
|
||||
|
||||
_b_u_n_z_i_p_2 will correctly decompress a file which is the con
|
||||
catenation of two or more compressed files. The result is
|
||||
the concatenation of the corresponding uncompressed files.
|
||||
Integrity testing (−t) of concatenated compressed files is
|
||||
also supported.
|
||||
|
||||
You can also compress or decompress files to the standard
|
||||
output by giving the −c flag. Multiple files may be com
|
||||
pressed and decompressed like this. The resulting outputs
|
||||
are fed sequentially to stdout. Compression of multiple
|
||||
files in this manner generates a stream containing multi
|
||||
ple compressed file representations. Such a stream can be
|
||||
decompressed correctly only by _b_z_i_p_2 version 0.9.0 or
|
||||
later. Earlier versions of _b_z_i_p_2 will stop after decom
|
||||
pressing the first file in the stream.
|
||||
|
||||
_b_z_c_a_t (or _b_z_i_p_2 _‐_d_c_) decompresses all specified files to
|
||||
the standard output.
|
||||
|
||||
_b_z_i_p_2 will read arguments from the environment variables
|
||||
_B_Z_I_P_2 and _B_Z_I_P_, in that order, and will process them
|
||||
before any arguments read from the command line. This
|
||||
gives a convenient way to supply default arguments.
|
||||
|
||||
Compression is always performed, even if the compressed
|
||||
file is slightly larger than the original. Files of less
|
||||
than about one hundred bytes tend to get larger, since the
|
||||
compression mechanism has a constant overhead in the
|
||||
region of 50 bytes. Random data (including the output of
|
||||
most file compressors) is coded at about 8.05 bits per
|
||||
byte, giving an expansion of around 0.5%.
|
||||
|
||||
As a self‐check for your protection, _b_z_i_p_2 uses 32‐bit
|
||||
CRCs to make sure that the decompressed version of a file
|
||||
is identical to the original. This guards against corrup
|
||||
tion of the compressed data, and against undetected bugs
|
||||
in _b_z_i_p_2 (hopefully very unlikely). The chances of data
|
||||
corruption going undetected is microscopic, about one
|
||||
chance in four billion for each file processed. Be aware,
|
||||
though, that the check occurs upon decompression, so it
|
||||
can only tell you that something is wrong. It can’t help
|
||||
you recover the original uncompressed data. You can use
|
||||
_b_z_i_p_2_r_e_c_o_v_e_r to try to recover data from damaged files.
|
||||
|
||||
Return values: 0 for a normal exit, 1 for environmental
|
||||
problems (file not found, invalid flags, I/O errors, &c),
|
||||
2 to indicate a corrupt compressed file, 3 for an internal
|
||||
consistency error (eg, bug) which caused _b_z_i_p_2 to panic.
|
||||
|
||||
|
||||
OOPPTTIIOONNSS
|
||||
−−cc ‐‐‐‐ssttddoouutt
|
||||
Compress or decompress to standard output.
|
||||
|
||||
−−dd ‐‐‐‐ddeeccoommpprreessss
|
||||
Force decompression. _b_z_i_p_2_, _b_u_n_z_i_p_2 and _b_z_c_a_t are
|
||||
really the same program, and the decision about
|
||||
what actions to take is done on the basis of which
|
||||
name is used. This flag overrides that mechanism,
|
||||
and forces _b_z_i_p_2 to decompress.
|
||||
|
||||
−−zz ‐‐‐‐ccoommpprreessss
|
||||
The complement to −d: forces compression,
|
||||
regardless of the invocation name.
|
||||
|
||||
−−tt ‐‐‐‐tteesstt
|
||||
Check integrity of the specified file(s), but don’t
|
||||
decompress them. This really performs a trial
|
||||
decompression and throws away the result.
|
||||
|
||||
−−ff ‐‐‐‐ffoorrccee
|
||||
Force overwrite of output files. Normally, _b_z_i_p_2
|
||||
will not overwrite existing output files. Also
|
||||
forces _b_z_i_p_2 to break hard links to files, which it
|
||||
otherwise wouldn’t do.
|
||||
|
||||
bzip2 normally declines to decompress files which
|
||||
don’t have the correct magic header bytes. If
|
||||
forced (‐f), however, it will pass such files
|
||||
through unmodified. This is how GNU gzip behaves.
|
||||
|
||||
−−kk ‐‐‐‐kkeeeepp
|
||||
Keep (don’t delete) input files during compression
|
||||
or decompression.
|
||||
|
||||
−−ss ‐‐‐‐ssmmaallll
|
||||
Reduce memory usage, for compression, decompression
|
||||
and testing. Files are decompressed and tested
|
||||
using a modified algorithm which only requires 2.5
|
||||
bytes per block byte. This means any file can be
|
||||
decompressed in 2300k of memory, albeit at about
|
||||
half the normal speed.
|
||||
|
||||
During compression, −s selects a block size of
|
||||
200k, which limits memory use to around the same
|
||||
figure, at the expense of your compression ratio.
|
||||
In short, if your machine is low on memory (8
|
||||
megabytes or less), use −s for everything. See
|
||||
MEMORY MANAGEMENT below.
|
||||
|
||||
−−qq ‐‐‐‐qquuiieett
|
||||
Suppress non‐essential warning messages. Messages
|
||||
pertaining to I/O errors and other critical events
|
||||
will not be suppressed.
|
||||
|
||||
−−vv ‐‐‐‐vveerrbboossee
|
||||
Verbose mode ‐‐ show the compression ratio for each
|
||||
file processed. Further −v’s increase the ver
|
||||
bosity level, spewing out lots of information which
|
||||
is primarily of interest for diagnostic purposes.
|
||||
|
||||
−−LL ‐‐‐‐lliicceennssee ‐‐VV ‐‐‐‐vveerrssiioonn
|
||||
Display the software version, license terms and
|
||||
conditions.
|
||||
|
||||
−−11 ((oorr −−−−ffaasstt)) ttoo −−99 ((oorr −−−−bbeesstt))
|
||||
Set the block size to 100 k, 200 k .. 900 k when
|
||||
compressing. Has no effect when decompressing.
|
||||
See MEMORY MANAGEMENT below. The −−fast and −−best
|
||||
aliases are primarily for GNU gzip compatibility.
|
||||
In particular, −−fast doesn’t make things signifi
|
||||
cantly faster. And −−best merely selects the
|
||||
default behaviour.
|
||||
|
||||
−−‐‐ Treats all subsequent arguments as file names, even
|
||||
if they start with a dash. This is so you can han
|
||||
dle files with names beginning with a dash, for
|
||||
example: bzip2 −‐ −myfilename.
|
||||
|
||||
−−‐‐rreeppeettiittiivvee‐‐ffaasstt ‐‐‐‐rreeppeettiittiivvee‐‐bbeesstt
|
||||
These flags are redundant in versions 0.9.5 and
|
||||
above. They provided some coarse control over the
|
||||
behaviour of the sorting algorithm in earlier ver
|
||||
sions, which was sometimes useful. 0.9.5 and above
|
||||
have an improved algorithm which renders these
|
||||
flags irrelevant.
|
||||
|
||||
|
||||
MMEEMMOORRYY MMAANNAAGGEEMMEENNTT
|
||||
_b_z_i_p_2 compresses large files in blocks. The block size
|
||||
affects both the compression ratio achieved, and the
|
||||
amount of memory needed for compression and decompression.
|
||||
The flags −1 through −9 specify the block size to be
|
||||
100,000 bytes through 900,000 bytes (the default) respec
|
||||
tively. At decompression time, the block size used for
|
||||
compression is read from the header of the compressed
|
||||
file, and _b_u_n_z_i_p_2 then allocates itself just enough memory
|
||||
to decompress the file. Since block sizes are stored in
|
||||
compressed files, it follows that the flags −1 to −9 are
|
||||
irrelevant to and so ignored during decompression.
|
||||
|
||||
Compression and decompression requirements, in bytes, can
|
||||
be estimated as:
|
||||
|
||||
Compression: 400k + ( 8 x block size )
|
||||
|
||||
Decompression: 100k + ( 4 x block size ), or
|
||||
100k + ( 2.5 x block size )
|
||||
|
||||
Larger block sizes give rapidly diminishing marginal
|
||||
returns. Most of the compression comes from the first two
|
||||
or three hundred k of block size, a fact worth bearing in
|
||||
mind when using _b_z_i_p_2 on small machines. It is also
|
||||
important to appreciate that the decompression memory
|
||||
requirement is set at compression time by the choice of
|
||||
block size.
|
||||
|
||||
For files compressed with the default 900k block size,
|
||||
_b_u_n_z_i_p_2 will require about 3700 kbytes to decompress. To
|
||||
support decompression of any file on a 4 megabyte machine,
|
||||
_b_u_n_z_i_p_2 has an option to decompress using approximately
|
||||
half this amount of memory, about 2300 kbytes. Decompres
|
||||
sion speed is also halved, so you should use this option
|
||||
only where necessary. The relevant flag is ‐s.
|
||||
|
||||
In general, try and use the largest block size memory con
|
||||
straints allow, since that maximises the compression
|
||||
achieved. Compression and decompression speed are virtu
|
||||
ally unaffected by block size.
|
||||
|
||||
Another significant point applies to files which fit in a
|
||||
single block ‐‐ that means most files you’d encounter
|
||||
using a large block size. The amount of real memory
|
||||
touched is proportional to the size of the file, since the
|
||||
file is smaller than a block. For example, compressing a
|
||||
file 20,000 bytes long with the flag ‐9 will cause the
|
||||
compressor to allocate around 7600k of memory, but only
|
||||
touch 400k + 20000 * 8 = 560 kbytes of it. Similarly, the
|
||||
decompressor will allocate 3700k but only touch 100k +
|
||||
20000 * 4 = 180 kbytes.
|
||||
|
||||
Here is a table which summarises the maximum memory usage
|
||||
for different block sizes. Also recorded is the total
|
||||
compressed size for 14 files of the Calgary Text Compres
|
||||
sion Corpus totalling 3,141,622 bytes. This column gives
|
||||
some feel for how compression varies with block size.
|
||||
These figures tend to understate the advantage of larger
|
||||
block sizes for larger files, since the Corpus is domi
|
||||
nated by smaller files.
|
||||
|
||||
Compress Decompress Decompress Corpus
|
||||
Flag usage usage ‐s usage Size
|
||||
|
||||
‐1 1200k 500k 350k 914704
|
||||
‐2 2000k 900k 600k 877703
|
||||
‐3 2800k 1300k 850k 860338
|
||||
‐4 3600k 1700k 1100k 846899
|
||||
‐5 4400k 2100k 1350k 845160
|
||||
‐6 5200k 2500k 1600k 838626
|
||||
‐7 6100k 2900k 1850k 834096
|
||||
‐8 6800k 3300k 2100k 828642
|
||||
‐9 7600k 3700k 2350k 828642
|
||||
|
||||
|
||||
RREECCOOVVEERRIINNGG DDAATTAA FFRROOMM DDAAMMAAGGEEDD FFIILLEESS
|
||||
_b_z_i_p_2 compresses files in blocks, usually 900kbytes long.
|
||||
Each block is handled independently. If a media or trans
|
||||
mission error causes a multi‐block .bz2 file to become
|
||||
damaged, it may be possible to recover data from the
|
||||
undamaged blocks in the file.
|
||||
|
||||
The compressed representation of each block is delimited
|
||||
by a 48‐bit pattern, which makes it possible to find the
|
||||
block boundaries with reasonable certainty. Each block
|
||||
also carries its own 32‐bit CRC, so damaged blocks can be
|
||||
distinguished from undamaged ones.
|
||||
|
||||
_b_z_i_p_2_r_e_c_o_v_e_r is a simple program whose purpose is to
|
||||
search for blocks in .bz2 files, and write each block out
|
||||
into its own .bz2 file. You can then use _b_z_i_p_2 −t to test
|
||||
the integrity of the resulting files, and decompress those
|
||||
which are undamaged.
|
||||
|
||||
_b_z_i_p_2_r_e_c_o_v_e_r takes a single argument, the name of the dam
|
||||
aged file, and writes a number of files
|
||||
"rec00001file.bz2", "rec00002file.bz2", etc, containing
|
||||
the extracted blocks. The output filenames are
|
||||
designed so that the use of wildcards in subsequent pro
|
||||
cessing ‐‐ for example, "bzip2 ‐dc rec*file.bz2 > recov
|
||||
ered_data" ‐‐ processes the files in the correct order.
|
||||
|
||||
_b_z_i_p_2_r_e_c_o_v_e_r should be of most use dealing with large .bz2
|
||||
files, as these will contain many blocks. It is clearly
|
||||
futile to use it on damaged single‐block files, since a
|
||||
damaged block cannot be recovered. If you wish to min
|
||||
imise any potential data loss through media or transmis
|
||||
sion errors, you might consider compressing with a smaller
|
||||
block size.
|
||||
|
||||
|
||||
PPEERRFFOORRMMAANNCCEE NNOOTTEESS
|
||||
The sorting phase of compression gathers together similar
|
||||
strings in the file. Because of this, files containing
|
||||
very long runs of repeated symbols, like "aabaabaabaab
|
||||
..." (repeated several hundred times) may compress more
|
||||
slowly than normal. Versions 0.9.5 and above fare much
|
||||
better than previous versions in this respect. The ratio
|
||||
between worst‐case and average‐case compression time is in
|
||||
the region of 10:1. For previous versions, this figure
|
||||
was more like 100:1. You can use the −vvvv option to mon
|
||||
itor progress in great detail, if you want.
|
||||
|
||||
Decompression speed is unaffected by these phenomena.
|
||||
|
||||
_b_z_i_p_2 usually allocates several megabytes of memory to
|
||||
operate in, and then charges all over it in a fairly ran
|
||||
dom fashion. This means that performance, both for com
|
||||
pressing and decompressing, is largely determined by the
|
||||
speed at which your machine can service cache misses.
|
||||
Because of this, small changes to the code to reduce the
|
||||
miss rate have been observed to give disproportionately
|
||||
large performance improvements. I imagine _b_z_i_p_2 will per
|
||||
form best on machines with very large caches.
|
||||
|
||||
|
||||
CCAAVVEEAATTSS
|
||||
I/O error messages are not as helpful as they could be.
|
||||
_b_z_i_p_2 tries hard to detect I/O errors and exit cleanly,
|
||||
but the details of what the problem is sometimes seem
|
||||
rather misleading.
|
||||
|
||||
This manual page pertains to version 1.0.4 of _b_z_i_p_2_. Com
|
||||
pressed data created by this version is entirely forwards
|
||||
and backwards compatible with the previous public
|
||||
releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
|
||||
1.0.2 and 1.0.3, but with the following exception: 0.9.0
|
||||
and above can correctly decompress multiple concatenated
|
||||
compressed files. 0.1pl2 cannot do this; it will stop
|
||||
after decompressing just the first file in the stream.
|
||||
|
||||
_b_z_i_p_2_r_e_c_o_v_e_r versions prior to 1.0.2 used 32‐bit integers
|
||||
to represent bit positions in compressed files, so they
|
||||
could not handle compressed files more than 512 megabytes
|
||||
long. Versions 1.0.2 and above use 64‐bit ints on some
|
||||
platforms which support them (GNU supported targets, and
|
||||
Windows). To establish whether or not bzip2recover was
|
||||
built with such a limitation, run it without arguments.
|
||||
In any event you can build yourself an unlimited version
|
||||
if you can recompile it with MaybeUInt64 set to be an
|
||||
unsigned 64‐bit integer.
|
||||
|
||||
|
||||
|
||||
|
||||
AAUUTTHHOORR
|
||||
Julian Seward, jsewardbzip.org.
|
||||
|
||||
http://www.bzip.org
|
||||
|
||||
The ideas embodied in _b_z_i_p_2 are due to (at least) the fol
|
||||
lowing people: Michael Burrows and David Wheeler (for the
|
||||
block sorting transformation), David Wheeler (again, for
|
||||
the Huffman coder), Peter Fenwick (for the structured cod
|
||||
ing model in the original _b_z_i_p_, and many refinements), and
|
||||
Alistair Moffat, Radford Neal and Ian Witten (for the
|
||||
arithmetic coder in the original _b_z_i_p_)_. I am much
|
||||
indebted for their help, support and advice. See the man
|
||||
ual in the source distribution for pointers to sources of
|
||||
documentation. Christian von Roques encouraged me to look
|
||||
for faster sorting algorithms, so as to speed up compres
|
||||
sion. Bela Lubkin encouraged me to improve the worst‐case
|
||||
compression performance. Donna Robinson XMLised the docu
|
||||
mentation. The bz* scripts are derived from those of GNU
|
||||
gzip. Many people sent patches, helped with portability
|
||||
problems, lent machines, gave advice and were generally
|
||||
helpful.
|
||||
|
||||
|
||||
|
||||
bzip2(1)
|
@ -7,8 +7,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
@ -128,12 +128,12 @@
|
||||
#if BZ_LCCWIN32
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
# include <sys\stat.h>
|
||||
# include <sys/stat.h>
|
||||
|
||||
# define NORETURN /**/
|
||||
# define PATH_SEP '\\'
|
||||
# define MY_LSTAT _stat
|
||||
# define MY_STAT _stat
|
||||
# define MY_LSTAT _stati64
|
||||
# define MY_STAT _stati64
|
||||
# define MY_S_ISREG(x) ((x) & _S_IFREG)
|
||||
# define MY_S_ISDIR(x) ((x) & _S_IFDIR)
|
||||
|
||||
@ -380,27 +380,27 @@ void compressStream ( FILE *stream, FILE *zStream )
|
||||
|
||||
if (verbosity >= 1) {
|
||||
if (nbytes_in_lo32 == 0 && nbytes_in_hi32 == 0) {
|
||||
fprintf ( stderr, " no data compressed.\n");
|
||||
fprintf ( stderr, " no data compressed.\n");
|
||||
} else {
|
||||
Char buf_nin[32], buf_nout[32];
|
||||
UInt64 nbytes_in, nbytes_out;
|
||||
double nbytes_in_d, nbytes_out_d;
|
||||
uInt64_from_UInt32s ( &nbytes_in,
|
||||
nbytes_in_lo32, nbytes_in_hi32 );
|
||||
uInt64_from_UInt32s ( &nbytes_out,
|
||||
nbytes_out_lo32, nbytes_out_hi32 );
|
||||
nbytes_in_d = uInt64_to_double ( &nbytes_in );
|
||||
nbytes_out_d = uInt64_to_double ( &nbytes_out );
|
||||
uInt64_toAscii ( buf_nin, &nbytes_in );
|
||||
uInt64_toAscii ( buf_nout, &nbytes_out );
|
||||
fprintf ( stderr, "%6.3f:1, %6.3f bits/byte, "
|
||||
"%5.2f%% saved, %s in, %s out.\n",
|
||||
nbytes_in_d / nbytes_out_d,
|
||||
(8.0 * nbytes_out_d) / nbytes_in_d,
|
||||
100.0 * (1.0 - nbytes_out_d / nbytes_in_d),
|
||||
buf_nin,
|
||||
buf_nout
|
||||
);
|
||||
Char buf_nin[32], buf_nout[32];
|
||||
UInt64 nbytes_in, nbytes_out;
|
||||
double nbytes_in_d, nbytes_out_d;
|
||||
uInt64_from_UInt32s ( &nbytes_in,
|
||||
nbytes_in_lo32, nbytes_in_hi32 );
|
||||
uInt64_from_UInt32s ( &nbytes_out,
|
||||
nbytes_out_lo32, nbytes_out_hi32 );
|
||||
nbytes_in_d = uInt64_to_double ( &nbytes_in );
|
||||
nbytes_out_d = uInt64_to_double ( &nbytes_out );
|
||||
uInt64_toAscii ( buf_nin, &nbytes_in );
|
||||
uInt64_toAscii ( buf_nout, &nbytes_out );
|
||||
fprintf ( stderr, "%6.3f:1, %6.3f bits/byte, "
|
||||
"%5.2f%% saved, %s in, %s out.\n",
|
||||
nbytes_in_d / nbytes_out_d,
|
||||
(8.0 * nbytes_out_d) / nbytes_in_d,
|
||||
100.0 * (1.0 - nbytes_out_d / nbytes_in_d),
|
||||
buf_nin,
|
||||
buf_nout
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -505,11 +505,11 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
|
||||
if (forceOverwrite) {
|
||||
rewind(zStream);
|
||||
while (True) {
|
||||
if (myfeof(zStream)) break;
|
||||
nread = fread ( obuf, sizeof(UChar), 5000, zStream );
|
||||
if (ferror(zStream)) goto errhandler_io;
|
||||
if (nread > 0) fwrite ( obuf, sizeof(UChar), nread, stream );
|
||||
if (ferror(stream)) goto errhandler_io;
|
||||
if (myfeof(zStream)) break;
|
||||
nread = fread ( obuf, sizeof(UChar), 5000, zStream );
|
||||
if (ferror(zStream)) goto errhandler_io;
|
||||
if (nread > 0) fwrite ( obuf, sizeof(UChar), nread, stream );
|
||||
if (ferror(stream)) goto errhandler_io;
|
||||
}
|
||||
goto closeok;
|
||||
}
|
||||
@ -554,7 +554,7 @@ static
|
||||
Bool testStream ( FILE *zStream )
|
||||
{
|
||||
BZFILE* bzf = NULL;
|
||||
Int32 bzerr, bzerr_dummy, ret, nread, streamNo, i;
|
||||
Int32 bzerr, bzerr_dummy, ret, streamNo, i;
|
||||
UChar obuf[5000];
|
||||
UChar unused[BZ_MAX_UNUSED];
|
||||
Int32 nUnused;
|
||||
@ -577,7 +577,7 @@ Bool testStream ( FILE *zStream )
|
||||
streamNo++;
|
||||
|
||||
while (bzerr == BZ_OK) {
|
||||
nread = BZ2_bzRead ( &bzerr, bzf, obuf, 5000 );
|
||||
BZ2_bzRead ( &bzerr, bzf, obuf, 5000 );
|
||||
if (bzerr == BZ_DATA_ERROR_MAGIC) goto errhandler;
|
||||
}
|
||||
if (bzerr != BZ_STREAM_END) goto errhandler;
|
||||
@ -748,8 +748,8 @@ void panic ( const Char* s )
|
||||
fprintf ( stderr,
|
||||
"\n%s: PANIC -- internal consistency error:\n"
|
||||
"\t%s\n"
|
||||
"\tThis is a BUG. Please report it to me at:\n"
|
||||
"\tjseward@bzip.org\n",
|
||||
"\tThis is a BUG. Please report it to:\n"
|
||||
"\tbzip2-devel@sourceware.org\n",
|
||||
progName, s );
|
||||
showFileNames();
|
||||
cleanUpAndFail( 3 );
|
||||
@ -775,9 +775,9 @@ void compressedStreamEOF ( void )
|
||||
{
|
||||
if (noisy) {
|
||||
fprintf ( stderr,
|
||||
"\n%s: Compressed file ends unexpectedly;\n\t"
|
||||
"perhaps it is corrupted? *Possible* reason follows.\n",
|
||||
progName );
|
||||
"\n%s: Compressed file ends unexpectedly;\n\t"
|
||||
"perhaps it is corrupted? *Possible* reason follows.\n",
|
||||
progName );
|
||||
perror ( progName );
|
||||
showFileNames();
|
||||
cadvise();
|
||||
@ -829,7 +829,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n )
|
||||
" The user's manual, Section 4.3, has more info on (1) and (2).\n"
|
||||
" \n"
|
||||
" If you suspect this is a bug in bzip2, or are unsure about (1)\n"
|
||||
" or (2), feel free to report it to me at: jseward@bzip.org.\n"
|
||||
" or (2), feel free to report it to: bzip2-devel@sourceware.org.\n"
|
||||
" Section 4.3 of the user's manual describes the info a useful\n"
|
||||
" bug report should have. If the manual is available on your\n"
|
||||
" system, please try and read it before mailing me. If you don't\n"
|
||||
@ -852,7 +852,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n )
|
||||
" The user's manual, Section 4.3, has more info on (2) and (3).\n"
|
||||
" \n"
|
||||
" If you suspect this is a bug in bzip2, or are unsure about (2)\n"
|
||||
" or (3), feel free to report it to me at: jseward@bzip.org.\n"
|
||||
" or (3), feel free to report it to: bzip2-devel@sourceware.org.\n"
|
||||
" Section 4.3 of the user's manual describes the info a useful\n"
|
||||
" bug report should have. If the manual is available on your\n"
|
||||
" system, please try and read it before mailing me. If you don't\n"
|
||||
@ -1200,12 +1200,12 @@ void compress ( Char *name )
|
||||
}
|
||||
if ( srcMode == SM_F2F && fileExists ( outName ) ) {
|
||||
if (forceOverwrite) {
|
||||
remove(outName);
|
||||
remove(outName);
|
||||
} else {
|
||||
fprintf ( stderr, "%s: Output file %s already exists.\n",
|
||||
progName, outName );
|
||||
setExit(1);
|
||||
return;
|
||||
fprintf ( stderr, "%s: Output file %s already exists.\n",
|
||||
progName, outName );
|
||||
setExit(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( srcMode == SM_F2F && !forceOverwrite &&
|
||||
@ -1386,7 +1386,7 @@ void uncompress ( Char *name )
|
||||
}
|
||||
if ( srcMode == SM_F2F && fileExists ( outName ) ) {
|
||||
if (forceOverwrite) {
|
||||
remove(outName);
|
||||
remove(outName);
|
||||
} else {
|
||||
fprintf ( stderr, "%s: Output file %s already exists.\n",
|
||||
progName, outName );
|
||||
@ -1605,11 +1605,11 @@ void license ( void )
|
||||
"bzip2, a block-sorting file compressor. "
|
||||
"Version %s.\n"
|
||||
" \n"
|
||||
" Copyright (C) 1996-2007 by Julian Seward.\n"
|
||||
" Copyright (C) 1996-2019 by Julian Seward.\n"
|
||||
" \n"
|
||||
" This program is free software; you can redistribute it and/or modify\n"
|
||||
" it under the terms set out in the LICENSE file, which is included\n"
|
||||
" in the bzip2-1.0.5 source distribution.\n"
|
||||
" in the bzip2 source distribution.\n"
|
||||
" \n"
|
||||
" This program is distributed in the hope that it will be useful,\n"
|
||||
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
@ -1997,18 +1997,20 @@ IntNative main ( IntNative argc, Char *argv[] )
|
||||
} else {
|
||||
decode = True;
|
||||
for (aa = argList; aa != NULL; aa = aa->link) {
|
||||
if (ISFLAG("--")) { decode = False; continue; }
|
||||
if (ISFLAG("--")) { decode = False; continue; }
|
||||
if (aa->name[0] == '-' && decode) continue;
|
||||
numFilesProcessed++;
|
||||
testf ( aa->name );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (testFailsExist && noisy) {
|
||||
fprintf ( stderr,
|
||||
"\n"
|
||||
"You can use the `bzip2recover' program to attempt to recover\n"
|
||||
"data from undamaged sections of corrupted files.\n\n"
|
||||
);
|
||||
if (testFailsExist) {
|
||||
if (noisy) {
|
||||
fprintf ( stderr,
|
||||
"\n"
|
||||
"You can use the `bzip2recover' program to attempt to recover\n"
|
||||
"data from undamaged sections of corrupted files.\n\n"
|
||||
);
|
||||
}
|
||||
setExit(2);
|
||||
exit(exitValue);
|
||||
}
|
||||
|
@ -1,391 +0,0 @@
|
||||
|
||||
NAME
|
||||
bzip2, bunzip2 - a block-sorting file compressor, v1.0.4
|
||||
bzcat - decompresses files to stdout
|
||||
bzip2recover - recovers data from damaged bzip2 files
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ... ]
|
||||
bunzip2 [ -fkvsVL ] [ filenames ... ]
|
||||
bzcat [ -s ] [ filenames ... ]
|
||||
bzip2recover filename
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
bzip2 compresses files using the Burrows-Wheeler block
|
||||
sorting text compression algorithm, and Huffman coding.
|
||||
Compression is generally considerably better than that
|
||||
achieved by more conventional LZ77/LZ78-based compressors,
|
||||
and approaches the performance of the PPM family of sta-
|
||||
tistical compressors.
|
||||
|
||||
The command-line options are deliberately very similar to
|
||||
those of GNU gzip, but they are not identical.
|
||||
|
||||
bzip2 expects a list of file names to accompany the com-
|
||||
mand-line flags. Each file is replaced by a compressed
|
||||
version of itself, with the name "original_name.bz2".
|
||||
Each compressed file has the same modification date, per-
|
||||
missions, and, when possible, ownership as the correspond-
|
||||
ing original, so that these properties can be correctly
|
||||
restored at decompression time. File name handling is
|
||||
naive in the sense that there is no mechanism for preserv-
|
||||
ing original file names, permissions, ownerships or dates
|
||||
in filesystems which lack these concepts, or have serious
|
||||
file name length restrictions, such as MS-DOS.
|
||||
|
||||
bzip2 and bunzip2 will by default not overwrite existing
|
||||
files. If you want this to happen, specify the -f flag.
|
||||
|
||||
If no file names are specified, bzip2 compresses from
|
||||
standard input to standard output. In this case, bzip2
|
||||
will decline to write compressed output to a terminal, as
|
||||
this would be entirely incomprehensible and therefore
|
||||
pointless.
|
||||
|
||||
bunzip2 (or bzip2 -d) decompresses all specified files.
|
||||
Files which were not created by bzip2 will be detected and
|
||||
ignored, and a warning issued. bzip2 attempts to guess
|
||||
the filename for the decompressed file from that of the
|
||||
compressed file as follows:
|
||||
|
||||
filename.bz2 becomes filename
|
||||
filename.bz becomes filename
|
||||
filename.tbz2 becomes filename.tar
|
||||
filename.tbz becomes filename.tar
|
||||
anyothername becomes anyothername.out
|
||||
|
||||
If the file does not end in one of the recognised endings,
|
||||
.bz2, .bz, .tbz2 or .tbz, bzip2 complains that it cannot
|
||||
guess the name of the original file, and uses the original
|
||||
name with .out appended.
|
||||
|
||||
As with compression, supplying no filenames causes decom-
|
||||
pression from standard input to standard output.
|
||||
|
||||
bunzip2 will correctly decompress a file which is the con-
|
||||
catenation of two or more compressed files. The result is
|
||||
the concatenation of the corresponding uncompressed files.
|
||||
Integrity testing (-t) of concatenated compressed files is
|
||||
also supported.
|
||||
|
||||
You can also compress or decompress files to the standard
|
||||
output by giving the -c flag. Multiple files may be com-
|
||||
pressed and decompressed like this. The resulting outputs
|
||||
are fed sequentially to stdout. Compression of multiple
|
||||
files in this manner generates a stream containing multi-
|
||||
ple compressed file representations. Such a stream can be
|
||||
decompressed correctly only by bzip2 version 0.9.0 or
|
||||
later. Earlier versions of bzip2 will stop after decom-
|
||||
pressing the first file in the stream.
|
||||
|
||||
bzcat (or bzip2 -dc) decompresses all specified files to
|
||||
the standard output.
|
||||
|
||||
bzip2 will read arguments from the environment variables
|
||||
BZIP2 and BZIP, in that order, and will process them
|
||||
before any arguments read from the command line. This
|
||||
gives a convenient way to supply default arguments.
|
||||
|
||||
Compression is always performed, even if the compressed
|
||||
file is slightly larger than the original. Files of less
|
||||
than about one hundred bytes tend to get larger, since the
|
||||
compression mechanism has a constant overhead in the
|
||||
region of 50 bytes. Random data (including the output of
|
||||
most file compressors) is coded at about 8.05 bits per
|
||||
byte, giving an expansion of around 0.5%.
|
||||
|
||||
As a self-check for your protection, bzip2 uses 32-bit
|
||||
CRCs to make sure that the decompressed version of a file
|
||||
is identical to the original. This guards against corrup-
|
||||
tion of the compressed data, and against undetected bugs
|
||||
in bzip2 (hopefully very unlikely). The chances of data
|
||||
corruption going undetected is microscopic, about one
|
||||
chance in four billion for each file processed. Be aware,
|
||||
though, that the check occurs upon decompression, so it
|
||||
can only tell you that something is wrong. It can't help
|
||||
you recover the original uncompressed data. You can use
|
||||
bzip2recover to try to recover data from damaged files.
|
||||
|
||||
Return values: 0 for a normal exit, 1 for environmental
|
||||
problems (file not found, invalid flags, I/O errors, &c),
|
||||
2 to indicate a corrupt compressed file, 3 for an internal
|
||||
consistency error (eg, bug) which caused bzip2 to panic.
|
||||
|
||||
|
||||
OPTIONS
|
||||
-c --stdout
|
||||
Compress or decompress to standard output.
|
||||
|
||||
-d --decompress
|
||||
Force decompression. bzip2, bunzip2 and bzcat are
|
||||
really the same program, and the decision about
|
||||
what actions to take is done on the basis of which
|
||||
name is used. This flag overrides that mechanism,
|
||||
and forces bzip2 to decompress.
|
||||
|
||||
-z --compress
|
||||
The complement to -d: forces compression,
|
||||
regardless of the invocation name.
|
||||
|
||||
-t --test
|
||||
Check integrity of the specified file(s), but don't
|
||||
decompress them. This really performs a trial
|
||||
decompression and throws away the result.
|
||||
|
||||
-f --force
|
||||
Force overwrite of output files. Normally, bzip2
|
||||
will not overwrite existing output files. Also
|
||||
forces bzip2 to break hard links to files, which it
|
||||
otherwise wouldn't do.
|
||||
|
||||
bzip2 normally declines to decompress files which
|
||||
don't have the correct magic header bytes. If
|
||||
forced (-f), however, it will pass such files
|
||||
through unmodified. This is how GNU gzip behaves.
|
||||
|
||||
-k --keep
|
||||
Keep (don't delete) input files during compression
|
||||
or decompression.
|
||||
|
||||
-s --small
|
||||
Reduce memory usage, for compression, decompression
|
||||
and testing. Files are decompressed and tested
|
||||
using a modified algorithm which only requires 2.5
|
||||
bytes per block byte. This means any file can be
|
||||
decompressed in 2300k of memory, albeit at about
|
||||
half the normal speed.
|
||||
|
||||
During compression, -s selects a block size of
|
||||
200k, which limits memory use to around the same
|
||||
figure, at the expense of your compression ratio.
|
||||
In short, if your machine is low on memory (8
|
||||
megabytes or less), use -s for everything. See
|
||||
MEMORY MANAGEMENT below.
|
||||
|
||||
-q --quiet
|
||||
Suppress non-essential warning messages. Messages
|
||||
pertaining to I/O errors and other critical events
|
||||
will not be suppressed.
|
||||
|
||||
-v --verbose
|
||||
Verbose mode -- show the compression ratio for each
|
||||
file processed. Further -v's increase the ver-
|
||||
bosity level, spewing out lots of information which
|
||||
is primarily of interest for diagnostic purposes.
|
||||
|
||||
-L --license -V --version
|
||||
Display the software version, license terms and
|
||||
conditions.
|
||||
|
||||
-1 (or --fast) to -9 (or --best)
|
||||
Set the block size to 100 k, 200 k .. 900 k when
|
||||
compressing. Has no effect when decompressing.
|
||||
See MEMORY MANAGEMENT below. The --fast and --best
|
||||
aliases are primarily for GNU gzip compatibility.
|
||||
In particular, --fast doesn't make things signifi-
|
||||
cantly faster. And --best merely selects the
|
||||
default behaviour.
|
||||
|
||||
-- Treats all subsequent arguments as file names, even
|
||||
if they start with a dash. This is so you can han-
|
||||
dle files with names beginning with a dash, for
|
||||
example: bzip2 -- -myfilename.
|
||||
|
||||
--repetitive-fast --repetitive-best
|
||||
These flags are redundant in versions 0.9.5 and
|
||||
above. They provided some coarse control over the
|
||||
behaviour of the sorting algorithm in earlier ver-
|
||||
sions, which was sometimes useful. 0.9.5 and above
|
||||
have an improved algorithm which renders these
|
||||
flags irrelevant.
|
||||
|
||||
|
||||
MEMORY MANAGEMENT
|
||||
bzip2 compresses large files in blocks. The block size
|
||||
affects both the compression ratio achieved, and the
|
||||
amount of memory needed for compression and decompression.
|
||||
The flags -1 through -9 specify the block size to be
|
||||
100,000 bytes through 900,000 bytes (the default) respec-
|
||||
tively. At decompression time, the block size used for
|
||||
compression is read from the header of the compressed
|
||||
file, and bunzip2 then allocates itself just enough memory
|
||||
to decompress the file. Since block sizes are stored in
|
||||
compressed files, it follows that the flags -1 to -9 are
|
||||
irrelevant to and so ignored during decompression.
|
||||
|
||||
Compression and decompression requirements, in bytes, can
|
||||
be estimated as:
|
||||
|
||||
Compression: 400k + ( 8 x block size )
|
||||
|
||||
Decompression: 100k + ( 4 x block size ), or
|
||||
100k + ( 2.5 x block size )
|
||||
|
||||
Larger block sizes give rapidly diminishing marginal
|
||||
returns. Most of the compression comes from the first two
|
||||
or three hundred k of block size, a fact worth bearing in
|
||||
mind when using bzip2 on small machines. It is also
|
||||
important to appreciate that the decompression memory
|
||||
requirement is set at compression time by the choice of
|
||||
block size.
|
||||
|
||||
For files compressed with the default 900k block size,
|
||||
bunzip2 will require about 3700 kbytes to decompress. To
|
||||
support decompression of any file on a 4 megabyte machine,
|
||||
bunzip2 has an option to decompress using approximately
|
||||
half this amount of memory, about 2300 kbytes. Decompres-
|
||||
sion speed is also halved, so you should use this option
|
||||
only where necessary. The relevant flag is -s.
|
||||
|
||||
In general, try and use the largest block size memory con-
|
||||
straints allow, since that maximises the compression
|
||||
achieved. Compression and decompression speed are virtu-
|
||||
ally unaffected by block size.
|
||||
|
||||
Another significant point applies to files which fit in a
|
||||
single block -- that means most files you'd encounter
|
||||
using a large block size. The amount of real memory
|
||||
touched is proportional to the size of the file, since the
|
||||
file is smaller than a block. For example, compressing a
|
||||
file 20,000 bytes long with the flag -9 will cause the
|
||||
compressor to allocate around 7600k of memory, but only
|
||||
touch 400k + 20000 * 8 = 560 kbytes of it. Similarly, the
|
||||
decompressor will allocate 3700k but only touch 100k +
|
||||
20000 * 4 = 180 kbytes.
|
||||
|
||||
Here is a table which summarises the maximum memory usage
|
||||
for different block sizes. Also recorded is the total
|
||||
compressed size for 14 files of the Calgary Text Compres-
|
||||
sion Corpus totalling 3,141,622 bytes. This column gives
|
||||
some feel for how compression varies with block size.
|
||||
These figures tend to understate the advantage of larger
|
||||
block sizes for larger files, since the Corpus is domi-
|
||||
nated by smaller files.
|
||||
|
||||
Compress Decompress Decompress Corpus
|
||||
Flag usage usage -s usage Size
|
||||
|
||||
-1 1200k 500k 350k 914704
|
||||
-2 2000k 900k 600k 877703
|
||||
-3 2800k 1300k 850k 860338
|
||||
-4 3600k 1700k 1100k 846899
|
||||
-5 4400k 2100k 1350k 845160
|
||||
-6 5200k 2500k 1600k 838626
|
||||
-7 6100k 2900k 1850k 834096
|
||||
-8 6800k 3300k 2100k 828642
|
||||
-9 7600k 3700k 2350k 828642
|
||||
|
||||
|
||||
RECOVERING DATA FROM DAMAGED FILES
|
||||
bzip2 compresses files in blocks, usually 900kbytes long.
|
||||
Each block is handled independently. If a media or trans-
|
||||
mission error causes a multi-block .bz2 file to become
|
||||
damaged, it may be possible to recover data from the
|
||||
undamaged blocks in the file.
|
||||
|
||||
The compressed representation of each block is delimited
|
||||
by a 48-bit pattern, which makes it possible to find the
|
||||
block boundaries with reasonable certainty. Each block
|
||||
also carries its own 32-bit CRC, so damaged blocks can be
|
||||
distinguished from undamaged ones.
|
||||
|
||||
bzip2recover is a simple program whose purpose is to
|
||||
search for blocks in .bz2 files, and write each block out
|
||||
into its own .bz2 file. You can then use bzip2 -t to test
|
||||
the integrity of the resulting files, and decompress those
|
||||
which are undamaged.
|
||||
|
||||
bzip2recover takes a single argument, the name of the dam-
|
||||
aged file, and writes a number of files
|
||||
"rec00001file.bz2", "rec00002file.bz2", etc, containing
|
||||
the extracted blocks. The output filenames are
|
||||
designed so that the use of wildcards in subsequent pro-
|
||||
cessing -- for example, "bzip2 -dc rec*file.bz2 > recov-
|
||||
ered_data" -- processes the files in the correct order.
|
||||
|
||||
bzip2recover should be of most use dealing with large .bz2
|
||||
files, as these will contain many blocks. It is clearly
|
||||
futile to use it on damaged single-block files, since a
|
||||
damaged block cannot be recovered. If you wish to min-
|
||||
imise any potential data loss through media or transmis-
|
||||
sion errors, you might consider compressing with a smaller
|
||||
block size.
|
||||
|
||||
|
||||
PERFORMANCE NOTES
|
||||
The sorting phase of compression gathers together similar
|
||||
strings in the file. Because of this, files containing
|
||||
very long runs of repeated symbols, like "aabaabaabaab
|
||||
..." (repeated several hundred times) may compress more
|
||||
slowly than normal. Versions 0.9.5 and above fare much
|
||||
better than previous versions in this respect. The ratio
|
||||
between worst-case and average-case compression time is in
|
||||
the region of 10:1. For previous versions, this figure
|
||||
was more like 100:1. You can use the -vvvv option to mon-
|
||||
itor progress in great detail, if you want.
|
||||
|
||||
Decompression speed is unaffected by these phenomena.
|
||||
|
||||
bzip2 usually allocates several megabytes of memory to
|
||||
operate in, and then charges all over it in a fairly ran-
|
||||
dom fashion. This means that performance, both for com-
|
||||
pressing and decompressing, is largely determined by the
|
||||
speed at which your machine can service cache misses.
|
||||
Because of this, small changes to the code to reduce the
|
||||
miss rate have been observed to give disproportionately
|
||||
large performance improvements. I imagine bzip2 will per-
|
||||
form best on machines with very large caches.
|
||||
|
||||
|
||||
CAVEATS
|
||||
I/O error messages are not as helpful as they could be.
|
||||
bzip2 tries hard to detect I/O errors and exit cleanly,
|
||||
but the details of what the problem is sometimes seem
|
||||
rather misleading.
|
||||
|
||||
This manual page pertains to version 1.0.4 of bzip2. Com-
|
||||
pressed data created by this version is entirely forwards
|
||||
and backwards compatible with the previous public
|
||||
releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
|
||||
1.0.2 and 1.0.3, but with the following exception: 0.9.0
|
||||
and above can correctly decompress multiple concatenated
|
||||
compressed files. 0.1pl2 cannot do this; it will stop
|
||||
after decompressing just the first file in the stream.
|
||||
|
||||
bzip2recover versions prior to 1.0.2 used 32-bit integers
|
||||
to represent bit positions in compressed files, so they
|
||||
could not handle compressed files more than 512 megabytes
|
||||
long. Versions 1.0.2 and above use 64-bit ints on some
|
||||
platforms which support them (GNU supported targets, and
|
||||
Windows). To establish whether or not bzip2recover was
|
||||
built with such a limitation, run it without arguments.
|
||||
In any event you can build yourself an unlimited version
|
||||
if you can recompile it with MaybeUInt64 set to be an
|
||||
unsigned 64-bit integer.
|
||||
|
||||
|
||||
AUTHOR
|
||||
Julian Seward, jsewardbzip.org.
|
||||
|
||||
http://www.bzip.org
|
||||
|
||||
The ideas embodied in bzip2 are due to (at least) the fol-
|
||||
lowing people: Michael Burrows and David Wheeler (for the
|
||||
block sorting transformation), David Wheeler (again, for
|
||||
the Huffman coder), Peter Fenwick (for the structured cod-
|
||||
ing model in the original bzip, and many refinements), and
|
||||
Alistair Moffat, Radford Neal and Ian Witten (for the
|
||||
arithmetic coder in the original bzip). I am much
|
||||
indebted for their help, support and advice. See the man-
|
||||
ual in the source distribution for pointers to sources of
|
||||
documentation. Christian von Roques encouraged me to look
|
||||
for faster sorting algorithms, so as to speed up compres-
|
||||
sion. Bela Lubkin encouraged me to improve the worst-case
|
||||
compression performance. Donna Robinson XMLised the docu-
|
||||
mentation. The bz* scripts are derived from those of GNU
|
||||
gzip. Many people sent patches, helped with portability
|
||||
problems, lent machines, gave advice and were generally
|
||||
helpful.
|
||||
|
@ -7,8 +7,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
@ -18,7 +18,7 @@
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
/* This program is a complete hack and should be rewritten properly.
|
||||
It isn't very complicated. */
|
||||
It isn't very complicated. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
@ -309,11 +309,12 @@ Int32 main ( Int32 argc, Char** argv )
|
||||
UInt32 buffHi, buffLo, blockCRC;
|
||||
Char* p;
|
||||
|
||||
strcpy ( progName, argv[0] );
|
||||
strncpy ( progName, argv[0], BZ_MAX_FILENAME-1);
|
||||
progName[BZ_MAX_FILENAME-1]='\0';
|
||||
inFileName[0] = outFileName[0] = 0;
|
||||
|
||||
fprintf ( stderr,
|
||||
"bzip2recover 1.0.5: extracts blocks from damaged .bz2 files.\n" );
|
||||
"bzip2recover 1.0.8: extracts blocks from damaged .bz2 files.\n" );
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n",
|
||||
@ -393,7 +394,7 @@ Int32 main ( Int32 argc, Char** argv )
|
||||
bEnd[currBlock] = 0;
|
||||
}
|
||||
if (currBlock > 0 &&
|
||||
(bEnd[currBlock] - bStart[currBlock]) >= 130) {
|
||||
(bEnd[currBlock] - bStart[currBlock]) >= 130) {
|
||||
fprintf ( stderr, " block %d runs from " MaybeUInt64_FMT
|
||||
" to " MaybeUInt64_FMT "\n",
|
||||
rbCtr+1, bStart[currBlock], bEnd[currBlock] );
|
||||
@ -457,6 +458,7 @@ Int32 main ( Int32 argc, Char** argv )
|
||||
bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 );
|
||||
bsPutUInt32 ( bsWr, blockCRC );
|
||||
bsClose ( bsWr );
|
||||
outFile = NULL;
|
||||
}
|
||||
if (wrBlock >= rbCtr) break;
|
||||
wrBlock++;
|
||||
@ -474,8 +476,8 @@ Int32 main ( Int32 argc, Char** argv )
|
||||
split = outFileName;
|
||||
} else {
|
||||
++split;
|
||||
}
|
||||
/* Now split points to the start of the basename. */
|
||||
}
|
||||
/* Now split points to the start of the basename. */
|
||||
ofs = split - outFileName;
|
||||
sprintf (split, "rec%5d", wrBlock+1);
|
||||
for (p = split; *p != 0; p++) if (*p == ' ') *p = '0';
|
||||
|
@ -8,8 +8,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
@ -43,12 +43,12 @@ void BZ2_bz__AssertH__fail ( int errcode )
|
||||
fprintf(stderr,
|
||||
"\n\nbzip2/libbzip2: internal error number %d.\n"
|
||||
"This is a bug in bzip2/libbzip2, %s.\n"
|
||||
"Please report it to me at: jseward@bzip.org. If this happened\n"
|
||||
"Please report it to: bzip2-devel@sourceware.org. If this happened\n"
|
||||
"when you were using some program which uses libbzip2 as a\n"
|
||||
"component, you should also report this bug to the author(s)\n"
|
||||
"of that program. Please make an effort to report this bug;\n"
|
||||
"timely and accurate bug reports eventually lead to higher\n"
|
||||
"quality software. Thanks. Julian Seward, 10 December 2007.\n\n",
|
||||
"quality software. Thanks.\n\n",
|
||||
errcode,
|
||||
BZ2_bzlibVersion()
|
||||
);
|
||||
@ -102,7 +102,6 @@ static
|
||||
void* default_bzalloc ( void* opaque, Int32 items, Int32 size )
|
||||
{
|
||||
void* v = malloc ( items * size );
|
||||
(void)opaque;
|
||||
return v;
|
||||
}
|
||||
|
||||
@ -110,7 +109,6 @@ static
|
||||
void default_bzfree ( void* opaque, void* addr )
|
||||
{
|
||||
if (addr != NULL) free ( addr );
|
||||
(void)opaque;
|
||||
}
|
||||
|
||||
|
||||
@ -427,7 +425,7 @@ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action )
|
||||
return progress ? BZ_RUN_OK : BZ_PARAM_ERROR;
|
||||
}
|
||||
else
|
||||
if (action == BZ_FLUSH) {
|
||||
if (action == BZ_FLUSH) {
|
||||
s->avail_in_expect = strm->avail_in;
|
||||
s->mode = BZ_M_FLUSHING;
|
||||
goto preswitch;
|
||||
@ -1507,7 +1505,6 @@ int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len )
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzflush) (BZFILE *b)
|
||||
{
|
||||
(void) b;
|
||||
/* do nothing now... */
|
||||
return 0;
|
||||
}
|
||||
|
@ -8,8 +8,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
@ -8,8 +8,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
@ -33,27 +33,10 @@
|
||||
#include "bzlib.h"
|
||||
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
# pragma warn -8004 /* Assigned value never used. */
|
||||
# pragma warn -8008 /* Condition is always true/false. */
|
||||
# pragma warn -8066 /* Unreachable code. */
|
||||
# pragma warn -8057 /* Unused parameter. */
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
/* 'integral size mismatch in argument; conversion supplied */
|
||||
# pragma warning(disable:4244)
|
||||
/* conversion from 'size_t' to 'off_t', possible loss of data */
|
||||
# pragma warning(disable:4267)
|
||||
/* warning C4127: conditional expression is constant*/
|
||||
# pragma warning(disable:4127)
|
||||
#endif
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic ignored "-Wcast-align"
|
||||
#endif
|
||||
|
||||
/*-- General stuff. --*/
|
||||
|
||||
#define BZ_VERSION "1.0.5, 10-Dec-2007"
|
||||
#define BZ_VERSION "1.0.8, 13-Jul-2019"
|
||||
|
||||
typedef char Char;
|
||||
typedef unsigned char Bool;
|
||||
|
@ -1,61 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Bzmore wrapped for bzip2,
|
||||
# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
||||
|
||||
PATH="/usr/bin:$PATH"; export PATH
|
||||
|
||||
prog=`echo $0 | sed 's|.*/||'`
|
||||
case "$prog" in
|
||||
*less) more=less ;;
|
||||
*) more=more ;;
|
||||
esac
|
||||
|
||||
if test "`echo -n a`" = "-n a"; then
|
||||
# looks like a SysV system:
|
||||
n1=''; n2='\c'
|
||||
else
|
||||
n1='-n'; n2=''
|
||||
fi
|
||||
oldtty=`stty -g 2>/dev/null`
|
||||
if stty -cbreak 2>/dev/null; then
|
||||
cb='cbreak'; ncb='-cbreak'
|
||||
else
|
||||
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
||||
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
||||
fi
|
||||
if test $? -eq 0 -a -n "$oldtty"; then
|
||||
trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
|
||||
else
|
||||
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
|
||||
fi
|
||||
|
||||
if test $# = 0; then
|
||||
if test -t 0; then
|
||||
echo usage: $prog files...
|
||||
else
|
||||
bzip2 -cdfq | eval $more
|
||||
fi
|
||||
else
|
||||
FIRST=1
|
||||
for FILE
|
||||
do
|
||||
if test $FIRST -eq 0; then
|
||||
echo $n1 "--More--(Next file: $FILE)$n2"
|
||||
stty $cb -echo 2>/dev/null
|
||||
ANS=`dd bs=1 count=1 2>/dev/null`
|
||||
stty $ncb echo 2>/dev/null
|
||||
echo " "
|
||||
if test "$ANS" = 'e' -o "$ANS" = 'q'; then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
if test "$ANS" != 's'; then
|
||||
echo "------> $FILE <------"
|
||||
bzip2 -cdfq "$FILE" | eval $more
|
||||
fi
|
||||
if test -t; then
|
||||
FIRST=0
|
||||
fi
|
||||
done
|
||||
fi
|
@ -1,152 +0,0 @@
|
||||
.\"Shamelessly copied from zmore.1 by Philippe Troin <phil@fifi.org>
|
||||
.\"for Debian GNU/Linux
|
||||
.TH BZMORE 1
|
||||
.SH NAME
|
||||
bzmore, bzless \- file perusal filter for crt viewing of bzip2 compressed text
|
||||
.SH SYNOPSIS
|
||||
.B bzmore
|
||||
[ name ... ]
|
||||
.br
|
||||
.B bzless
|
||||
[ name ... ]
|
||||
.SH NOTE
|
||||
In the following description,
|
||||
.I bzless
|
||||
and
|
||||
.I less
|
||||
can be used interchangeably with
|
||||
.I bzmore
|
||||
and
|
||||
.I more.
|
||||
.SH DESCRIPTION
|
||||
.I Bzmore
|
||||
is a filter which allows examination of compressed or plain text files
|
||||
one screenful at a time on a soft-copy terminal.
|
||||
.I bzmore
|
||||
works on files compressed with
|
||||
.I bzip2
|
||||
and also on uncompressed files.
|
||||
If a file does not exist,
|
||||
.I bzmore
|
||||
looks for a file of the same name with the addition of a .bz2 suffix.
|
||||
.PP
|
||||
.I Bzmore
|
||||
normally pauses after each screenful, printing --More--
|
||||
at the bottom of the screen.
|
||||
If the user then types a carriage return, one more line is displayed.
|
||||
If the user hits a space,
|
||||
another screenful is displayed. Other possibilities are enumerated later.
|
||||
.PP
|
||||
.I Bzmore
|
||||
looks in the file
|
||||
.I /etc/termcap
|
||||
to determine terminal characteristics,
|
||||
and to determine the default window size.
|
||||
On a terminal capable of displaying 24 lines,
|
||||
the default window size is 22 lines.
|
||||
Other sequences which may be typed when
|
||||
.I bzmore
|
||||
pauses, and their effects, are as follows (\fIi\fP is an optional integer
|
||||
argument, defaulting to 1) :
|
||||
.PP
|
||||
.IP \fIi\|\fP<space>
|
||||
display
|
||||
.I i
|
||||
more lines, (or another screenful if no argument is given)
|
||||
.PP
|
||||
.IP ^D
|
||||
display 11 more lines (a ``scroll'').
|
||||
If
|
||||
.I i
|
||||
is given, then the scroll size is set to \fIi\|\fP.
|
||||
.PP
|
||||
.IP d
|
||||
same as ^D (control-D)
|
||||
.PP
|
||||
.IP \fIi\|\fPz
|
||||
same as typing a space except that \fIi\|\fP, if present, becomes the new
|
||||
window size. Note that the window size reverts back to the default at the
|
||||
end of the current file.
|
||||
.PP
|
||||
.IP \fIi\|\fPs
|
||||
skip \fIi\|\fP lines and print a screenful of lines
|
||||
.PP
|
||||
.IP \fIi\|\fPf
|
||||
skip \fIi\fP screenfuls and print a screenful of lines
|
||||
.PP
|
||||
.IP "q or Q"
|
||||
quit reading the current file; go on to the next (if any)
|
||||
.PP
|
||||
.IP "e or q"
|
||||
When the prompt --More--(Next file:
|
||||
.IR file )
|
||||
is printed, this command causes bzmore to exit.
|
||||
.PP
|
||||
.IP s
|
||||
When the prompt --More--(Next file:
|
||||
.IR file )
|
||||
is printed, this command causes bzmore to skip the next file and continue.
|
||||
.PP
|
||||
.IP =
|
||||
Display the current line number.
|
||||
.PP
|
||||
.IP \fIi\|\fP/expr
|
||||
search for the \fIi\|\fP-th occurrence of the regular expression \fIexpr.\fP
|
||||
If the pattern is not found,
|
||||
.I bzmore
|
||||
goes on to the next file (if any).
|
||||
Otherwise, a screenful is displayed, starting two lines before the place
|
||||
where the expression was found.
|
||||
The user's erase and kill characters may be used to edit the regular
|
||||
expression.
|
||||
Erasing back past the first column cancels the search command.
|
||||
.PP
|
||||
.IP \fIi\|\fPn
|
||||
search for the \fIi\|\fP-th occurrence of the last regular expression entered.
|
||||
.PP
|
||||
.IP !command
|
||||
invoke a shell with \fIcommand\|\fP.
|
||||
The character `!' in "command" are replaced with the
|
||||
previous shell command. The sequence "\\!" is replaced by "!".
|
||||
.PP
|
||||
.IP ":q or :Q"
|
||||
quit reading the current file; go on to the next (if any)
|
||||
(same as q or Q).
|
||||
.PP
|
||||
.IP .
|
||||
(dot) repeat the previous command.
|
||||
.PP
|
||||
The commands take effect immediately, i.e., it is not necessary to
|
||||
type a carriage return.
|
||||
Up to the time when the command character itself is given,
|
||||
the user may hit the line kill character to cancel the numerical
|
||||
argument being formed.
|
||||
In addition, the user may hit the erase character to redisplay the
|
||||
--More-- message.
|
||||
.PP
|
||||
At any time when output is being sent to the terminal, the user can
|
||||
hit the quit key (normally control\-\\).
|
||||
.I Bzmore
|
||||
will stop sending output, and will display the usual --More--
|
||||
prompt.
|
||||
The user may then enter one of the above commands in the normal manner.
|
||||
Unfortunately, some output is lost when this is done, due to the
|
||||
fact that any characters waiting in the terminal's output queue
|
||||
are flushed when the quit signal occurs.
|
||||
.PP
|
||||
The terminal is set to
|
||||
.I noecho
|
||||
mode by this program so that the output can be continuous.
|
||||
What you type will thus not show on your terminal, except for the / and !
|
||||
commands.
|
||||
.PP
|
||||
If the standard output is not a teletype, then
|
||||
.I bzmore
|
||||
acts just like
|
||||
.I bzcat,
|
||||
except that a header is printed before each file.
|
||||
.SH FILES
|
||||
.DT
|
||||
/etc/termcap Terminal data base
|
||||
.SH "SEE ALSO"
|
||||
more(1), less(1), bzip2(1), bzdiff(1), bzgrep(1)
|
@ -8,8 +8,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
@ -239,7 +239,7 @@ static
|
||||
void sendMTFValues ( EState* s )
|
||||
{
|
||||
Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
|
||||
Int32 nSelectors = 0, alphaSize, minLen, maxLen, selCtr;
|
||||
Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
|
||||
Int32 nGroups, nBytes;
|
||||
|
||||
/*--
|
||||
@ -329,14 +329,14 @@ void sendMTFValues ( EState* s )
|
||||
|
||||
/*---
|
||||
Set up an auxiliary length table which is used to fast-track
|
||||
the common case (nGroups == 6).
|
||||
the common case (nGroups == 6).
|
||||
---*/
|
||||
if (nGroups == 6) {
|
||||
for (v = 0; v < alphaSize; v++) {
|
||||
s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v];
|
||||
s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v];
|
||||
s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nSelectors = 0;
|
||||
@ -385,7 +385,7 @@ void sendMTFValues ( EState* s )
|
||||
cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16;
|
||||
|
||||
} else {
|
||||
/*--- slow version which correctly handles all situations ---*/
|
||||
/*--- slow version which correctly handles all situations ---*/
|
||||
for (i = gs; i <= ge; i++) {
|
||||
UInt16 icv = mtfv[i];
|
||||
for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
|
||||
@ -426,7 +426,7 @@ void sendMTFValues ( EState* s )
|
||||
# undef BZ_ITUR
|
||||
|
||||
} else {
|
||||
/*--- slow version which correctly handles all situations ---*/
|
||||
/*--- slow version which correctly handles all situations ---*/
|
||||
for (i = gs; i <= ge; i++)
|
||||
s->rfreq[bt][ mtfv[i] ]++;
|
||||
}
|
||||
@ -454,7 +454,7 @@ void sendMTFValues ( EState* s )
|
||||
|
||||
AssertH( nGroups < 8, 3002 );
|
||||
AssertH( nSelectors < 32768 &&
|
||||
nSelectors <= (2 + (900000 / BZ_G_SIZE)),
|
||||
nSelectors <= BZ_MAX_SELECTORS,
|
||||
3003 );
|
||||
|
||||
|
||||
@ -579,7 +579,7 @@ void sendMTFValues ( EState* s )
|
||||
# undef BZ_ITAH
|
||||
|
||||
} else {
|
||||
/*--- slow version which correctly handles all situations ---*/
|
||||
/*--- slow version which correctly handles all situations ---*/
|
||||
for (i = gs; i <= ge; i++) {
|
||||
bsW ( s,
|
||||
s->len [s->selector[selCtr]] [mtfv[i]],
|
||||
|
@ -8,8 +8,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
@ -8,8 +8,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
@ -285,7 +285,7 @@ Int32 BZ2_decompress ( DState* s )
|
||||
|
||||
/*--- Now the selectors ---*/
|
||||
GET_BITS(BZ_X_SELECTOR_1, nGroups, 3);
|
||||
if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR);
|
||||
if (nGroups < 2 || nGroups > BZ_N_GROUPS) RETURN(BZ_DATA_ERROR);
|
||||
GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15);
|
||||
if (nSelectors < 1) RETURN(BZ_DATA_ERROR);
|
||||
for (i = 0; i < nSelectors; i++) {
|
||||
@ -296,8 +296,14 @@ Int32 BZ2_decompress ( DState* s )
|
||||
j++;
|
||||
if (j >= nGroups) RETURN(BZ_DATA_ERROR);
|
||||
}
|
||||
s->selectorMtf[i] = j;
|
||||
/* Having more than BZ_MAX_SELECTORS doesn't make much sense
|
||||
since they will never be used, but some implementations might
|
||||
"round up" the number of selectors, so just ignore those. */
|
||||
if (i < BZ_MAX_SELECTORS)
|
||||
s->selectorMtf[i] = j;
|
||||
}
|
||||
if (nSelectors > BZ_MAX_SELECTORS)
|
||||
nSelectors = BZ_MAX_SELECTORS;
|
||||
|
||||
/*--- Undo the MTF values for the selectors. ---*/
|
||||
{
|
||||
@ -381,6 +387,13 @@ Int32 BZ2_decompress ( DState* s )
|
||||
es = -1;
|
||||
N = 1;
|
||||
do {
|
||||
/* Check that N doesn't get too big, so that es doesn't
|
||||
go negative. The maximum value that can be
|
||||
RUNA/RUNB encoded is equal to the block size (post
|
||||
the initial RLE), viz, 900k, so bounding N at 2
|
||||
million should guard against overflow without
|
||||
rejecting any legitimate inputs. */
|
||||
if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR);
|
||||
if (nextSym == BZ_RUNA) es = es + (0+1) * N; else
|
||||
if (nextSym == BZ_RUNB) es = es + (1+1) * N;
|
||||
N = N * 2;
|
||||
@ -485,15 +498,28 @@ Int32 BZ2_decompress ( DState* s )
|
||||
RETURN(BZ_DATA_ERROR);
|
||||
|
||||
/*-- Set up cftab to facilitate generation of T^(-1) --*/
|
||||
/* Check: unzftab entries in range. */
|
||||
for (i = 0; i <= 255; i++) {
|
||||
if (s->unzftab[i] < 0 || s->unzftab[i] > nblock)
|
||||
RETURN(BZ_DATA_ERROR);
|
||||
}
|
||||
/* Actually generate cftab. */
|
||||
s->cftab[0] = 0;
|
||||
for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
|
||||
for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
|
||||
/* Check: cftab entries in range. */
|
||||
for (i = 0; i <= 256; i++) {
|
||||
if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
|
||||
/* s->cftab[i] can legitimately be == nblock */
|
||||
RETURN(BZ_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
/* Check: cftab entries non-descending. */
|
||||
for (i = 1; i <= 256; i++) {
|
||||
if (s->cftab[i-1] > s->cftab[i]) {
|
||||
RETURN(BZ_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
s->state_out_len = 0;
|
||||
s->state_out_ch = 0;
|
||||
|
@ -1,175 +1,175 @@
|
||||
/*
|
||||
minibz2
|
||||
libbz2.dll test program.
|
||||
by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
|
||||
This file is Public Domain. Welcome any email to me.
|
||||
|
||||
usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]
|
||||
*/
|
||||
|
||||
#define BZ_IMPORT
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "bzlib.h"
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define BZ2_LIBNAME "libbz2-1.0.2.DLL"
|
||||
|
||||
#include <windows.h>
|
||||
static int BZ2DLLLoaded = 0;
|
||||
static HINSTANCE BZ2DLLhLib;
|
||||
int BZ2DLLLoadLibrary(void)
|
||||
{
|
||||
HINSTANCE hLib;
|
||||
|
||||
if(BZ2DLLLoaded==1){return 0;}
|
||||
hLib=LoadLibrary(BZ2_LIBNAME);
|
||||
if(hLib == NULL){
|
||||
fprintf(stderr,"Can't load %s\n",BZ2_LIBNAME);
|
||||
return -1;
|
||||
}
|
||||
BZ2_bzlibVersion=GetProcAddress(hLib,"BZ2_bzlibVersion");
|
||||
BZ2_bzopen=GetProcAddress(hLib,"BZ2_bzopen");
|
||||
BZ2_bzdopen=GetProcAddress(hLib,"BZ2_bzdopen");
|
||||
BZ2_bzread=GetProcAddress(hLib,"BZ2_bzread");
|
||||
BZ2_bzwrite=GetProcAddress(hLib,"BZ2_bzwrite");
|
||||
BZ2_bzflush=GetProcAddress(hLib,"BZ2_bzflush");
|
||||
BZ2_bzclose=GetProcAddress(hLib,"BZ2_bzclose");
|
||||
BZ2_bzerror=GetProcAddress(hLib,"BZ2_bzerror");
|
||||
|
||||
if (!BZ2_bzlibVersion || !BZ2_bzopen || !BZ2_bzdopen
|
||||
|| !BZ2_bzread || !BZ2_bzwrite || !BZ2_bzflush
|
||||
|| !BZ2_bzclose || !BZ2_bzerror) {
|
||||
fprintf(stderr,"GetProcAddress failed.\n");
|
||||
return -1;
|
||||
}
|
||||
BZ2DLLLoaded=1;
|
||||
BZ2DLLhLib=hLib;
|
||||
return 0;
|
||||
|
||||
}
|
||||
int BZ2DLLFreeLibrary(void)
|
||||
{
|
||||
if(BZ2DLLLoaded==0){return 0;}
|
||||
FreeLibrary(BZ2DLLhLib);
|
||||
BZ2DLLLoaded=0;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
puts("usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]");
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int decompress = 0;
|
||||
int level = 9;
|
||||
char *fn_r = NULL;
|
||||
char *fn_w = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
if(BZ2DLLLoadLibrary()<0){
|
||||
fprintf(stderr,"Loading of %s failed. Giving up.\n", BZ2_LIBNAME);
|
||||
exit(1);
|
||||
}
|
||||
printf("Loading of %s succeeded. Library version is %s.\n",
|
||||
BZ2_LIBNAME, BZ2_bzlibVersion() );
|
||||
#endif
|
||||
while(++argv,--argc){
|
||||
if(**argv =='-' || **argv=='/'){
|
||||
char *p;
|
||||
|
||||
for(p=*argv+1;*p;p++){
|
||||
if(*p=='d'){
|
||||
decompress = 1;
|
||||
}else if('1'<=*p && *p<='9'){
|
||||
level = *p - '0';
|
||||
}else{
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(argc>=1){
|
||||
fn_r = *argv;
|
||||
argc--;argv++;
|
||||
}else{
|
||||
fn_r = NULL;
|
||||
}
|
||||
if(argc>=1){
|
||||
fn_w = *argv;
|
||||
argc--;argv++;
|
||||
}else{
|
||||
fn_w = NULL;
|
||||
}
|
||||
{
|
||||
int len;
|
||||
char buff[0x1000];
|
||||
char mode[10];
|
||||
|
||||
if(decompress){
|
||||
BZFILE *BZ2fp_r = NULL;
|
||||
FILE *fp_w = NULL;
|
||||
|
||||
if(fn_w){
|
||||
if((fp_w = fopen(fn_w,"wb"))==NULL){
|
||||
printf("can't open [%s]\n",fn_w);
|
||||
perror("reason:");
|
||||
exit(1);
|
||||
}
|
||||
}else{
|
||||
fp_w = stdout;
|
||||
}
|
||||
if((fn_r == NULL && (BZ2fp_r = BZ2_bzdopen(fileno(stdin),"rb"))==NULL)
|
||||
|| (fn_r != NULL && (BZ2fp_r = BZ2_bzopen(fn_r,"rb"))==NULL)){
|
||||
printf("can't bz2openstream\n");
|
||||
exit(1);
|
||||
}
|
||||
while((len=BZ2_bzread(BZ2fp_r,buff,0x1000))>0){
|
||||
fwrite(buff,1,len,fp_w);
|
||||
}
|
||||
BZ2_bzclose(BZ2fp_r);
|
||||
if(fp_w != stdout) fclose(fp_w);
|
||||
}else{
|
||||
BZFILE *BZ2fp_w = NULL;
|
||||
FILE *fp_r = NULL;
|
||||
|
||||
if(fn_r){
|
||||
if((fp_r = fopen(fn_r,"rb"))==NULL){
|
||||
printf("can't open [%s]\n",fn_r);
|
||||
perror("reason:");
|
||||
exit(1);
|
||||
}
|
||||
}else{
|
||||
fp_r = stdin;
|
||||
}
|
||||
mode[0]='w';
|
||||
mode[1] = '0' + level;
|
||||
mode[2] = '\0';
|
||||
|
||||
if((fn_w == NULL && (BZ2fp_w = BZ2_bzdopen(fileno(stdout),mode))==NULL)
|
||||
|| (fn_w !=NULL && (BZ2fp_w = BZ2_bzopen(fn_w,mode))==NULL)){
|
||||
printf("can't bz2openstream\n");
|
||||
exit(1);
|
||||
}
|
||||
while((len=fread(buff,1,0x1000,fp_r))>0){
|
||||
BZ2_bzwrite(BZ2fp_w,buff,len);
|
||||
}
|
||||
BZ2_bzclose(BZ2fp_w);
|
||||
if(fp_r!=stdin)fclose(fp_r);
|
||||
}
|
||||
}
|
||||
#ifdef _WIN32
|
||||
BZ2DLLFreeLibrary();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
minibz2
|
||||
libbz2.dll test program.
|
||||
by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
|
||||
This file is Public Domain. Welcome any email to me.
|
||||
|
||||
usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]
|
||||
*/
|
||||
|
||||
#define BZ_IMPORT
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "bzlib.h"
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define BZ2_LIBNAME "libbz2-1.0.2.DLL"
|
||||
|
||||
#include <windows.h>
|
||||
static int BZ2DLLLoaded = 0;
|
||||
static HINSTANCE BZ2DLLhLib;
|
||||
int BZ2DLLLoadLibrary(void)
|
||||
{
|
||||
HINSTANCE hLib;
|
||||
|
||||
if(BZ2DLLLoaded==1){return 0;}
|
||||
hLib=LoadLibrary(BZ2_LIBNAME);
|
||||
if(hLib == NULL){
|
||||
fprintf(stderr,"Can't load %s\n",BZ2_LIBNAME);
|
||||
return -1;
|
||||
}
|
||||
BZ2_bzlibVersion=GetProcAddress(hLib,"BZ2_bzlibVersion");
|
||||
BZ2_bzopen=GetProcAddress(hLib,"BZ2_bzopen");
|
||||
BZ2_bzdopen=GetProcAddress(hLib,"BZ2_bzdopen");
|
||||
BZ2_bzread=GetProcAddress(hLib,"BZ2_bzread");
|
||||
BZ2_bzwrite=GetProcAddress(hLib,"BZ2_bzwrite");
|
||||
BZ2_bzflush=GetProcAddress(hLib,"BZ2_bzflush");
|
||||
BZ2_bzclose=GetProcAddress(hLib,"BZ2_bzclose");
|
||||
BZ2_bzerror=GetProcAddress(hLib,"BZ2_bzerror");
|
||||
|
||||
if (!BZ2_bzlibVersion || !BZ2_bzopen || !BZ2_bzdopen
|
||||
|| !BZ2_bzread || !BZ2_bzwrite || !BZ2_bzflush
|
||||
|| !BZ2_bzclose || !BZ2_bzerror) {
|
||||
fprintf(stderr,"GetProcAddress failed.\n");
|
||||
return -1;
|
||||
}
|
||||
BZ2DLLLoaded=1;
|
||||
BZ2DLLhLib=hLib;
|
||||
return 0;
|
||||
|
||||
}
|
||||
int BZ2DLLFreeLibrary(void)
|
||||
{
|
||||
if(BZ2DLLLoaded==0){return 0;}
|
||||
FreeLibrary(BZ2DLLhLib);
|
||||
BZ2DLLLoaded=0;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
puts("usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]");
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int decompress = 0;
|
||||
int level = 9;
|
||||
char *fn_r = NULL;
|
||||
char *fn_w = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
if(BZ2DLLLoadLibrary()<0){
|
||||
fprintf(stderr,"Loading of %s failed. Giving up.\n", BZ2_LIBNAME);
|
||||
exit(1);
|
||||
}
|
||||
printf("Loading of %s succeeded. Library version is %s.\n",
|
||||
BZ2_LIBNAME, BZ2_bzlibVersion() );
|
||||
#endif
|
||||
while(++argv,--argc){
|
||||
if(**argv =='-' || **argv=='/'){
|
||||
char *p;
|
||||
|
||||
for(p=*argv+1;*p;p++){
|
||||
if(*p=='d'){
|
||||
decompress = 1;
|
||||
}else if('1'<=*p && *p<='9'){
|
||||
level = *p - '0';
|
||||
}else{
|
||||
usage();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(argc>=1){
|
||||
fn_r = *argv;
|
||||
argc--;argv++;
|
||||
}else{
|
||||
fn_r = NULL;
|
||||
}
|
||||
if(argc>=1){
|
||||
fn_w = *argv;
|
||||
argc--;argv++;
|
||||
}else{
|
||||
fn_w = NULL;
|
||||
}
|
||||
{
|
||||
int len;
|
||||
char buff[0x1000];
|
||||
char mode[10];
|
||||
|
||||
if(decompress){
|
||||
BZFILE *BZ2fp_r = NULL;
|
||||
FILE *fp_w = NULL;
|
||||
|
||||
if(fn_w){
|
||||
if((fp_w = fopen(fn_w,"wb"))==NULL){
|
||||
printf("can't open [%s]\n",fn_w);
|
||||
perror("reason:");
|
||||
exit(1);
|
||||
}
|
||||
}else{
|
||||
fp_w = stdout;
|
||||
}
|
||||
if((fn_r == NULL && (BZ2fp_r = BZ2_bzdopen(fileno(stdin),"rb"))==NULL)
|
||||
|| (fn_r != NULL && (BZ2fp_r = BZ2_bzopen(fn_r,"rb"))==NULL)){
|
||||
printf("can't bz2openstream\n");
|
||||
exit(1);
|
||||
}
|
||||
while((len=BZ2_bzread(BZ2fp_r,buff,0x1000))>0){
|
||||
fwrite(buff,1,len,fp_w);
|
||||
}
|
||||
BZ2_bzclose(BZ2fp_r);
|
||||
if(fp_w != stdout) fclose(fp_w);
|
||||
}else{
|
||||
BZFILE *BZ2fp_w = NULL;
|
||||
FILE *fp_r = NULL;
|
||||
|
||||
if(fn_r){
|
||||
if((fp_r = fopen(fn_r,"rb"))==NULL){
|
||||
printf("can't open [%s]\n",fn_r);
|
||||
perror("reason:");
|
||||
exit(1);
|
||||
}
|
||||
}else{
|
||||
fp_r = stdin;
|
||||
}
|
||||
mode[0]='w';
|
||||
mode[1] = '0' + level;
|
||||
mode[2] = '\0';
|
||||
|
||||
if((fn_w == NULL && (BZ2fp_w = BZ2_bzdopen(fileno(stdout),mode))==NULL)
|
||||
|| (fn_w !=NULL && (BZ2fp_w = BZ2_bzopen(fn_w,mode))==NULL)){
|
||||
printf("can't bz2openstream\n");
|
||||
exit(1);
|
||||
}
|
||||
while((len=fread(buff,1,0x1000,fp_r))>0){
|
||||
BZ2_bzwrite(BZ2fp_w,buff,len);
|
||||
}
|
||||
BZ2_bzclose(BZ2fp_w);
|
||||
if(fp_r!=stdin)fclose(fp_r);
|
||||
}
|
||||
}
|
||||
#ifdef _WIN32
|
||||
BZ2DLLFreeLibrary();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
<!-- misc. strings -->
|
||||
<!ENTITY bz-url "http://www.bzip.org">
|
||||
<!ENTITY bz-email "jseward@bzip.org">
|
||||
<!ENTITY bz-lifespan "1996-2007">
|
||||
|
||||
<!ENTITY bz-version "1.0.5">
|
||||
<!ENTITY bz-date "10 December 2007">
|
||||
|
||||
<!ENTITY manual-title "bzip2 Manual">
|
@ -1,68 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# ------------------------------------------------------------------
|
||||
# This file is part of bzip2/libbzip2, a program and library for
|
||||
# lossless, block-sorting data compression.
|
||||
#
|
||||
# bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
# Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
#
|
||||
# Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
# README file.
|
||||
#
|
||||
# This program is released under the terms of the license contained
|
||||
# in the file LICENSE.
|
||||
# ------------------------------------------------------------------
|
||||
#
|
||||
use strict;
|
||||
|
||||
# get command line values:
|
||||
if ( $#ARGV !=1 ) {
|
||||
die "Usage: $0 xml_infile xml_outfile\n";
|
||||
}
|
||||
|
||||
my $infile = shift;
|
||||
# check infile exists
|
||||
die "Can't find file \"$infile\""
|
||||
unless -f $infile;
|
||||
# check we can read infile
|
||||
if (! -r $infile) {
|
||||
die "Can't read input $infile\n";
|
||||
}
|
||||
# check we can open infile
|
||||
open( INFILE,"<$infile" ) or
|
||||
die "Can't input $infile $!";
|
||||
|
||||
#my $outfile = 'fmt-manual.xml';
|
||||
my $outfile = shift;
|
||||
#print "Infile: $infile, Outfile: $outfile\n";
|
||||
# check we can write to outfile
|
||||
open( OUTFILE,">$outfile" ) or
|
||||
die "Can't output $outfile $! for writing";
|
||||
|
||||
my ($prev, $curr, $str);
|
||||
$prev = ''; $curr = '';
|
||||
while ( <INFILE> ) {
|
||||
|
||||
print OUTFILE $prev;
|
||||
$prev = $curr;
|
||||
$curr = $_;
|
||||
$str = '';
|
||||
|
||||
if ( $prev =~ /<programlisting>$|<screen>$/ ) {
|
||||
chomp $prev;
|
||||
$curr = join( '', $prev, "<![CDATA[", $curr );
|
||||
$prev = '';
|
||||
next;
|
||||
}
|
||||
elsif ( $curr =~ /<\/programlisting>|<\/screen>/ ) {
|
||||
chomp $prev;
|
||||
$curr = join( '', $prev, "]]>", $curr );
|
||||
$prev = '';
|
||||
next;
|
||||
}
|
||||
}
|
||||
print OUTFILE $curr;
|
||||
close INFILE;
|
||||
close OUTFILE;
|
||||
exit;
|
@ -8,8 +8,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
@ -1,27 +0,0 @@
|
||||
LIBRARY LIBBZ2
|
||||
DESCRIPTION "libbzip2: library for data compression"
|
||||
EXPORTS
|
||||
BZ2_bzCompressInit
|
||||
BZ2_bzCompress
|
||||
BZ2_bzCompressEnd
|
||||
BZ2_bzDecompressInit
|
||||
BZ2_bzDecompress
|
||||
BZ2_bzDecompressEnd
|
||||
BZ2_bzReadOpen
|
||||
BZ2_bzReadClose
|
||||
BZ2_bzReadGetUnused
|
||||
BZ2_bzRead
|
||||
BZ2_bzWriteOpen
|
||||
BZ2_bzWrite
|
||||
BZ2_bzWriteClose
|
||||
BZ2_bzWriteClose64
|
||||
BZ2_bzBuffToBuffCompress
|
||||
BZ2_bzBuffToBuffDecompress
|
||||
BZ2_bzlibVersion
|
||||
BZ2_bzopen
|
||||
BZ2_bzdopen
|
||||
BZ2_bzread
|
||||
BZ2_bzwrite
|
||||
BZ2_bzflush
|
||||
BZ2_bzclose
|
||||
BZ2_bzerror
|
Binary file not shown.
@ -1,63 +0,0 @@
|
||||
# Makefile for Microsoft Visual C++ 6.0
|
||||
# usage: nmake -f makefile.msc
|
||||
# K.M. Syring (syring@gsf.de)
|
||||
# Fixed up by JRS for bzip2-0.9.5d release.
|
||||
|
||||
CC=cl
|
||||
CFLAGS= -DWIN32 -MD -Ox -D_FILE_OFFSET_BITS=64 -nologo
|
||||
|
||||
OBJS= blocksort.obj \
|
||||
huffman.obj \
|
||||
crctable.obj \
|
||||
randtable.obj \
|
||||
compress.obj \
|
||||
decompress.obj \
|
||||
bzlib.obj
|
||||
|
||||
all: lib bzip2 test
|
||||
|
||||
bzip2: lib
|
||||
$(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj
|
||||
$(CC) $(CFLAGS) -o bzip2recover bzip2recover.c
|
||||
|
||||
lib: $(OBJS)
|
||||
lib /out:libbz2.lib $(OBJS)
|
||||
|
||||
test: bzip2
|
||||
type words1
|
||||
.\\bzip2 -1 < sample1.ref > sample1.rb2
|
||||
.\\bzip2 -2 < sample2.ref > sample2.rb2
|
||||
.\\bzip2 -3 < sample3.ref > sample3.rb2
|
||||
.\\bzip2 -d < sample1.bz2 > sample1.tst
|
||||
.\\bzip2 -d < sample2.bz2 > sample2.tst
|
||||
.\\bzip2 -ds < sample3.bz2 > sample3.tst
|
||||
@echo All six of the fc's should find no differences.
|
||||
@echo If fc finds an error on sample3.bz2, this could be
|
||||
@echo because WinZip's 'TAR file smart CR/LF conversion'
|
||||
@echo is too clever for its own good. Disable this option.
|
||||
@echo The correct size for sample3.ref is 120,244. If it
|
||||
@echo is 150,251, WinZip has messed it up.
|
||||
fc sample1.bz2 sample1.rb2
|
||||
fc sample2.bz2 sample2.rb2
|
||||
fc sample3.bz2 sample3.rb2
|
||||
fc sample1.tst sample1.ref
|
||||
fc sample2.tst sample2.ref
|
||||
fc sample3.tst sample3.ref
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
del *.obj
|
||||
del libbz2.lib
|
||||
del bzip2.exe
|
||||
del bzip2recover.exe
|
||||
del sample1.rb2
|
||||
del sample2.rb2
|
||||
del sample3.rb2
|
||||
del sample1.tst
|
||||
del sample2.tst
|
||||
del sample3.tst
|
||||
|
||||
.c.obj:
|
||||
$(CC) $(CFLAGS) -c $*.c -o $*.obj
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -9,8 +9,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
@ -8,8 +8,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -13,15 +13,15 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------ */
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
@ -17,8 +17,8 @@
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
bzip2/libbzip2 version 1.0.8 of 13 July 2019
|
||||
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
@ -1,9 +0,0 @@
|
||||
|
||||
If compilation produces errors, or a large number of warnings,
|
||||
please read README.COMPILATION.PROBLEMS -- you might be able to
|
||||
adjust the flags in this Makefile to improve matters.
|
||||
|
||||
Also in README.COMPILATION.PROBLEMS are some hints that may help
|
||||
if your build produces an executable which is unable to correctly
|
||||
handle so-called 'large files' -- files of size 2GB or more.
|
||||
|
@ -1,4 +0,0 @@
|
||||
|
||||
Doing 6 tests (3 compress, 3 uncompress) ...
|
||||
If there's a problem, things might stop at this point.
|
||||
|
@ -1,5 +0,0 @@
|
||||
|
||||
Checking test results. If any of the four "cmp"s which follow
|
||||
report any differences, something is wrong. If you can't easily
|
||||
figure out what, please let me know (jseward@bzip.org).
|
||||
|
@ -1,30 +0,0 @@
|
||||
|
||||
If you got this far and the 'cmp's didn't complain, it looks
|
||||
like you're in business.
|
||||
|
||||
To install in /usr/local/bin, /usr/local/lib, /usr/local/man and
|
||||
/usr/local/include, type
|
||||
|
||||
make install
|
||||
|
||||
To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type
|
||||
|
||||
make install PREFIX=/xxx/yyy
|
||||
|
||||
If you are (justifiably) paranoid and want to see what 'make install'
|
||||
is going to do, you can first do
|
||||
|
||||
make -n install or
|
||||
make -n install PREFIX=/xxx/yyy respectively.
|
||||
|
||||
The -n instructs make to show the commands it would execute, but
|
||||
not actually execute them.
|
||||
|
||||
Instructions for use are in the preformatted manual page, in the file
|
||||
bzip2.txt. For more detailed documentation, read the full manual.
|
||||
It is available in Postscript form (manual.ps), PDF form (manual.pdf),
|
||||
and HTML form (manual.html).
|
||||
|
||||
You can also do "bzip2 --help" to see some helpful information.
|
||||
"bzip2 -L" displays the software license.
|
||||
|
@ -1,114 +0,0 @@
|
||||
#!/bin/bash
|
||||
# see the README file for usage etc.
|
||||
#
|
||||
# ------------------------------------------------------------------
|
||||
# This file is part of bzip2/libbzip2, a program and library for
|
||||
# lossless, block-sorting data compression.
|
||||
#
|
||||
# bzip2/libbzip2 version 1.0.5 of 10 December 2007
|
||||
# Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
|
||||
#
|
||||
# Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
# README file.
|
||||
#
|
||||
# This program is released under the terms of the license contained
|
||||
# in the file LICENSE.
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
||||
usage() {
|
||||
echo '';
|
||||
echo 'Usage: xmlproc.sh -[option] <filename.xml>';
|
||||
echo 'Specify a target from:';
|
||||
echo '-v verify xml file conforms to dtd';
|
||||
echo '-html output in html format (single file)';
|
||||
echo '-ps output in postscript format';
|
||||
echo '-pdf output in pdf format';
|
||||
exit;
|
||||
}
|
||||
|
||||
if test $# -ne 2; then
|
||||
usage
|
||||
fi
|
||||
# assign the variable for the output type
|
||||
action=$1; shift
|
||||
# assign the output filename
|
||||
xmlfile=$1; shift
|
||||
# and check user input it correct
|
||||
if !(test -f $xmlfile); then
|
||||
echo "No such file: $xmlfile";
|
||||
exit;
|
||||
fi
|
||||
# some other stuff we will use
|
||||
OUT=output
|
||||
xsl_fo=bz-fo.xsl
|
||||
xsl_html=bz-html.xsl
|
||||
|
||||
basename=$xmlfile
|
||||
basename=${basename//'.xml'/''}
|
||||
|
||||
fofile="${basename}.fo"
|
||||
htmlfile="${basename}.html"
|
||||
pdffile="${basename}.pdf"
|
||||
psfile="${basename}.ps"
|
||||
xmlfmtfile="${basename}.fmt"
|
||||
|
||||
# first process the xmlfile with CDATA tags
|
||||
./format.pl $xmlfile $xmlfmtfile
|
||||
# so the shell knows where the catalogs live
|
||||
export XML_CATALOG_FILES=/etc/xml/catalog
|
||||
|
||||
# post-processing tidy up
|
||||
cleanup() {
|
||||
echo "Cleaning up: $@"
|
||||
while [ $# != 0 ]
|
||||
do
|
||||
arg=$1; shift;
|
||||
echo " deleting $arg";
|
||||
rm $arg
|
||||
done
|
||||
}
|
||||
|
||||
case $action in
|
||||
-v)
|
||||
flags='--noout --xinclude --noblanks --postvalid'
|
||||
dtd='--dtdvalid http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd'
|
||||
xmllint $flags $dtd $xmlfmtfile 2> $OUT
|
||||
egrep 'error' $OUT
|
||||
rm $OUT
|
||||
;;
|
||||
|
||||
-html)
|
||||
echo "Creating $htmlfile ..."
|
||||
xsltproc --nonet --xinclude -o $htmlfile $xsl_html $xmlfmtfile
|
||||
cleanup $xmlfmtfile
|
||||
;;
|
||||
|
||||
-pdf)
|
||||
echo "Creating $pdffile ..."
|
||||
xsltproc --nonet --xinclude -o $fofile $xsl_fo $xmlfmtfile
|
||||
pdfxmltex $fofile >$OUT </dev/null
|
||||
pdfxmltex $fofile >$OUT </dev/null
|
||||
pdfxmltex $fofile >$OUT </dev/null
|
||||
cleanup $OUT $xmlfmtfile *.aux *.fo *.log *.out
|
||||
;;
|
||||
|
||||
-ps)
|
||||
echo "Creating $psfile ..."
|
||||
xsltproc --nonet --xinclude -o $fofile $xsl_fo $xmlfmtfile
|
||||
pdfxmltex $fofile >$OUT </dev/null
|
||||
pdfxmltex $fofile >$OUT </dev/null
|
||||
pdfxmltex $fofile >$OUT </dev/null
|
||||
pdftops $pdffile $psfile
|
||||
cleanup $OUT $xmlfmtfile $pdffile *.aux *.fo *.log *.out
|
||||
# passivetex is broken, so we can't go this route yet.
|
||||
# xmltex $fofile >$OUT </dev/null
|
||||
# xmltex $fofile >$OUT </dev/null
|
||||
# xmltex $fofile >$OUT </dev/null
|
||||
# dvips -R -q -o bzip-manual.ps *.dvi
|
||||
;;
|
||||
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user