Mail Archives: djgpp/1999/10/18/16:02:22
i don't know if this job has already been done
so i post here my port of bzip2-0.9.5d in the
hope that it would be useful.
i have tried to achive two goals:
1) in an LFN environment, program behaviour should be the same as the
unix original.
2) in an SFN environment, program behaviour should be similar to that
of the DJGPP port of gzip.
This means that when 8.3 file name restrictions applies,
the following naming rules are used:
At compression time:
filename -> filename.b
filename.e -> filename.eb
filename.ex -> filename.exb
filename.ext -> filename.exb
filename.tar -> filename.tbz
At decompression time:
filename.b -> filename
filename.eb -> filename.e
filename.exb -> filename.ex
filename.tbz -> filename.tar
filename -> filename.out
Due to some minor errors concerning the describtion of libbz2.a in
file manual.texi,
you will have to recreate the info- and html-docs if you want to
learn about how to
use the library. If you only want to know about program switches and
options
then the original docs are o.k.
A minor bug in bzip2recover.exe causing program abort with (ENOENT)
has been eliminated.
The package has been compiled with gcc-281 and libc.a (2.02)
on MSDOS and tested with MSDOS (SFN) and WIN9X(SFN/LFN).
Suggestions, comments, corrections,etc are welcome.
Regards
Guerrero, Juan Manuel
diff -aprNC7 bzip2-0.9.5d.orig/Makefile bzip2-0.9.5d.djgpp/Makefile
*** bzip2-0.9.5d.orig/Makefile Sat Sep 4 22:09:06 1999
--- bzip2-0.9.5d.djgpp/Makefile Mon Oct 18 18:39:56 1999
***************
*** 1,38 ****
SHELL=/bin/sh
CC=gcc
! CFLAGS=-Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduce
OBJS= blocksort.o \
huffman.o \
crctable.o \
randtable.o \
compress.o \
decompress.o \
bzlib.o
! all: libbz2.a bzip2 bzip2recover test
! bzip2: libbz2.a bzip2.o
! $(CC) $(CFLAGS) -o bzip2 bzip2.o -L. -lbz2
! bzip2recover: bzip2recover.o
! $(CC) $(CFLAGS) -o bzip2recover bzip2recover.o
libbz2.a: $(OBJS)
rm -f libbz2.a
ar cq libbz2.a $(OBJS)
! @if ( test -f /usr/bin/ranlib -o -f /bin/ranlib -o \
! -f /usr/ccs/bin/ranlib ) ; then \
! echo ranlib libbz2.a ; \
! ranlib libbz2.a ; \
! fi
! test: bzip2
@cat 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
--- 1,46 ----
SHELL=/bin/sh
CC=gcc
! # Choose the appropiate architecture: march=i386, i486, pentium,
pentiumpro
! CFLAGS=-Wall -Winline -O3 -march=pentium
! LDFLAGS=-s
!
! MAKEINFO=makeinfo
! MAKEINFOFLAGS=--no-split --force
OBJS= blocksort.o \
huffman.o \
crctable.o \
randtable.o \
compress.o \
decompress.o \
bzlib.o
! all: bzip2.info libbz2.a bzip2.exe bzip2recover.exe test
!
! bzip2.info: manual.texi
! $(MAKEINFO) $(MAKEINFOFLAGS) manual.texi -o bzip2.info
! bzip2.exe: libbz2.a bzip2.o
! $(CC) $(LDFLAGS) -o bzip2.exe bzip2.o -L. -lbz2
! -rm -f bunzip2.exe
! ln -s bzip2.exe bunzip2.exe
! -rm -f bzcat.exe
! ln -s bzip2.exe bzcat.exe
! bzip2recover.exe: bzip2recover.o
! $(CC) $(LDFLAGS) -o bzip2recover.exe bzip2recover.o
libbz2.a: $(OBJS)
rm -f libbz2.a
ar cq libbz2.a $(OBJS)
! ranlib libbz2.a
! test: bzip2.exe
@cat 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
*************** test: bzip2
*** 40,78 ****
cmp sample2.bz2 sample2.rb2
cmp sample3.bz2 sample3.rb2
cmp sample1.tst sample1.ref
cmp sample2.tst sample2.ref
cmp sample3.tst sample3.ref
@cat words3
! PREFIX=/usr
! install: bzip2 bzip2recover
if ( test ! -d $(PREFIX)/bin ) ; then mkdir $(PREFIX)/bin ; fi
if ( test ! -d $(PREFIX)/lib ) ; then mkdir $(PREFIX)/lib ; fi
if ( test ! -d $(PREFIX)/man ) ; then mkdir $(PREFIX)/man ; fi
if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir
$(PREFIX)/man/man1 ; fi
if ( test ! -d $(PREFIX)/include ) ; then mkdir $(PREFIX)/include
; fi
! cp -f bzip2 $(PREFIX)/bin/bzip2
! cp -f bzip2 $(PREFIX)/bin/bunzip2
! cp -f bzip2 $(PREFIX)/bin/bzcat
! cp -f bzip2recover $(PREFIX)/bin/bzip2recover
! chmod a+x $(PREFIX)/bin/bzip2
! chmod a+x $(PREFIX)/bin/bunzip2
! chmod a+x $(PREFIX)/bin/bzcat
! chmod a+x $(PREFIX)/bin/bzip2recover
cp -f bzip2.1 $(PREFIX)/man/man1
- chmod a+r $(PREFIX)/man/man1/bzip2.1
cp -f bzlib.h $(PREFIX)/include
- chmod a+r $(PREFIX)/include/bzlib.h
cp -f libbz2.a $(PREFIX)/lib
- chmod a+r $(PREFIX)/lib/libbz2.a
clean:
! rm -f *.o libbz2.a bzip2 bzip2recover \
sample1.rb2 sample2.rb2 sample3.rb2 \
sample1.tst sample2.tst sample3.tst
blocksort.o: blocksort.c
$(CC) $(CFLAGS) -c blocksort.c
huffman.o: huffman.c
$(CC) $(CFLAGS) -c huffman.c
--- 48,82 ----
cmp sample2.bz2 sample2.rb2
cmp sample3.bz2 sample3.rb2
cmp sample1.tst sample1.ref
cmp sample2.tst sample2.ref
cmp sample3.tst sample3.ref
@cat words3
! #Installation prefix.
! PREFIX=${DJDIR}
! install: bzip2.exe bzip2recover.exe libbz2.a bzip2.info
if ( test ! -d $(PREFIX)/bin ) ; then mkdir $(PREFIX)/bin ; fi
if ( test ! -d $(PREFIX)/lib ) ; then mkdir $(PREFIX)/lib ; fi
+ if ( test ! -d $(PREFIX)/info ) ; then mkdir $(PREFIX)/info ; fi
if ( test ! -d $(PREFIX)/man ) ; then mkdir $(PREFIX)/man ; fi
if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir
$(PREFIX)/man/man1 ; fi
if ( test ! -d $(PREFIX)/include ) ; then mkdir $(PREFIX)/include
; fi
! cp -f bzip2.exe $(PREFIX)/bin/bzip2.exe
! cp -f bunzip2.exe $(PREFIX)/bin/bunzip2.exe
! cp -f bzcat.exe $(PREFIX)/bin/bzcat.exe
! cp -f bzip2recover.exe $(PREFIX)/bin/bzip2recover.exe
! cp -f bzip2.info $(PREFIX)/info
cp -f bzip2.1 $(PREFIX)/man/man1
cp -f bzlib.h $(PREFIX)/include
cp -f libbz2.a $(PREFIX)/lib
clean:
! rm -f *.o *.exe *.info libbz2.a \
sample1.rb2 sample2.rb2 sample3.rb2 \
sample1.tst sample2.tst sample3.tst
blocksort.o: blocksort.c
$(CC) $(CFLAGS) -c blocksort.c
huffman.o: huffman.c
$(CC) $(CFLAGS) -c huffman.c
diff -aprNC7 bzip2-0.9.5d.orig/bzip2.c bzip2-0.9.5d.djgpp/bzip2.c
*** bzip2-0.9.5d.orig/bzip2.c Sat Sep 4 21:53:34 1999
--- bzip2-0.9.5d.djgpp/bzip2.c Mon Oct 18 18:39:56 1999
***************
*** 126,139 ****
--- 126,151 ----
#if defined(_WIN32) && !defined(__CYGWIN32__)
#undef BZ_LCCWIN32
#define BZ_LCCWIN32 1
#undef BZ_UNIX
#define BZ_UNIX 0
#endif
+ /*--
+ MS-DOS with DJGPP.
+ --*/
+ #define BZ_MSDOS 0
+
+ #ifdef __DJGPP__
+ #undef BZ_MSDOS
+ #define BZ_MSDOS 1
+ #undef BZ_UNIX
+ #define BZ_UNIX 1
+ #endif
+
/*---------------------------------------------*/
/*--
Some stuff for all platforms.
--*/
#include <stdio.h>
***************
*** 170,202 ****
# define APPEND_FILESPEC(root, name) \
root=snocString((root), (name))
# define APPEND_FLAG(root, name) \
root=snocString((root), (name))
# define SET_BINARY_MODE(fd) /**/
# ifdef __GNUC__
# define NORETURN __attribute__ ((noreturn))
# else
# define NORETURN /**/
# endif
- # ifdef __DJGPP__
- # include <io.h>
- # include <fcntl.h>
- # undef MY_LSTAT
- # define MY_LSTAT stat
- # undef SET_BINARY_MODE
- # define SET_BINARY_MODE(fd) \
- do { \
- int retVal = setmode ( fileno ( fd ), \
- O_BINARY ); \
- ERROR_IF_MINUS_ONE ( retVal ); \
- } while ( 0 )
- # endif
#endif
#if BZ_LCCWIN32
# include <io.h>
# include <fcntl.h>
--- 182,202 ----
# define APPEND_FILESPEC(root, name) \
root=snocString((root), (name))
# define APPEND_FLAG(root, name) \
root=snocString((root), (name))
# define SET_BINARY_MODE(fd) /**/
+ # define SET_TEXT_MODE(fd) /**/
# ifdef __GNUC__
# define NORETURN __attribute__ ((noreturn))
# else
# define NORETURN /**/
# endif
#endif
#if BZ_LCCWIN32
# include <io.h>
# include <fcntl.h>
***************
*** 240,254 ****
--- 240,294 ----
# define SET_BINARY_MODE(fd) \
do { \
int retVal = setmode ( fileno ( fd ), \
O_BINARY ); \
ERROR_IF_MINUS_ONE ( retVal ); \
} while ( 0 )
+ # define SET_TEXT_MODE(fd) /**/
+
+ #endif
+
+
+ /*--
+ MSDOS- and compiler specific functionality.
+ --*/
+ #if BZ_MSDOS
+ # ifdef __DJGPP__
+ # include <io.h>
+ # include <fcntl.h>
+ # define NO_LFN_SUPPORT (!_USE_LFN)
+ # define HAS_EXTENSION(filename) (strchr ((filename), '.')
!= NULL)
+ # define HAS_TAR_EXTENSION(filename) (strcmp
(&(filename)[extStart], ".tar") == NULL)
+ # endif
+
+ # ifndef S_ISLNK
+ # undef MY_LSTAT
+ # define MY_LSTAT stat
+ # endif
+
+ # if (defined(O_TEXT) != 0)
+ # undef SET_TEXT_MODE
+ # define SET_TEXT_MODE(fd) \
+ { \
+ int retVal = setmode (fileno (fd), O_TEXT ); \
+ ERROR_IF_MINUS_ONE (retVal) \
+ }
+ # endif
+
+ # if (defined(O_BINARY) != 0)
+ # undef SET_BINARY_MODE
+ # define SET_BINARY_MODE(fd) \
+ { \
+ int retVal = setmode (fileno (fd), O_BINARY ); \
+ ERROR_IF_MINUS_ONE (retVal) \
+ }
+ # endif
+ int _stklen = 524288; /* DPMI stack */
#endif
/*---------------------------------------------*/
/*--
Some more stuff for all platforms :-)
--*/
*************** void compress ( Char *name )
*** 909,923 ****
case SM_I2O:
copyFileName ( inName, "(stdin)" );
copyFileName ( outName, "(stdout)" );
break;
case SM_F2F:
copyFileName ( inName, name );
copyFileName ( outName, name );
! strcat ( outName, ".bz2" );
break;
case SM_F2O:
copyFileName ( inName, name );
copyFileName ( outName, "(stdout)" );
break;
}
--- 949,992 ----
case SM_I2O:
copyFileName ( inName, "(stdin)" );
copyFileName ( outName, "(stdout)" );
break;
case SM_F2F:
copyFileName ( inName, name );
copyFileName ( outName, name );
! #ifdef __DJGPP__
! if (NO_LFN_SUPPORT) /* MS-DOS 8.3 file name
restriction. */
! {
! if (HAS_EXTENSION (outName))
! {
! register IntNative extStart = (IntNative)(strchr
(outName, '.') - outName);
! if (HAS_TAR_EXTENSION (outName))
! {
! outName[extStart] = '\0';
! strcat (outName, ".tbz");
! }
! else
! {
! register IntNative extLen = strlen
(&outName[++extStart]);
! if (extLen <= 2) /* one or two character
extension. */
! strcat (outName, "b");
! else /* three character
extension. */
! {
! outName[extStart + 2] = '\0';
! strcat (outName, "b");
! break;
! }
! }
! }
! else /* no extension. */
! strcat (outName, ".b");
! }
! else /* no filename
restriction. */
! #endif
! strcat ( outName, ".bz2" );
break;
case SM_F2O:
copyFileName ( inName, name );
copyFileName ( outName, "(stdout)" );
break;
}
*************** void uncompress ( Char *name )
*** 1058,1071 ****
--- 1127,1148 ----
break;
case SM_F2F:
copyFileName ( inName, name );
copyFileName ( outName, name );
for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++)
if (mapSuffix(outName,zSuffix[i],unzSuffix[i]))
goto zzz;
+ #ifdef __DJGPP__
+ if (NO_LFN_SUPPORT && HAS_EXTENSION (outName)) /* MSDOS
8.3 filename restriction */
+ {
+ IntNative extEnd = strlen (outName);
+ outName[--extEnd] = '\0';
+ goto zzz;
+ }
+ #endif
cantGuess = True;
strcat ( outName, ".out" );
break;
case SM_F2O:
copyFileName ( inName, name );
copyFileName ( outName, "(stdout)" );
break;
*************** IntNative main ( IntNative argc, Char *a
*** 1469,1483 ****
numFilesProcessed = 0;
workFactor = 30;
i = j = 0; /* avoid bogus warning from egcs-1.1.X */
/*-- Set up signal handlers for mem access errors --*/
signal (SIGSEGV, mySIGSEGVorSIGBUScatcher);
#if BZ_UNIX
! #ifndef __DJGPP__
signal (SIGBUS, mySIGSEGVorSIGBUScatcher);
#endif
#endif
copyFileName ( inName, "(none)" );
copyFileName ( outName, "(none)" );
--- 1546,1560 ----
numFilesProcessed = 0;
workFactor = 30;
i = j = 0; /* avoid bogus warning from egcs-1.1.X */
/*-- Set up signal handlers for mem access errors --*/
signal (SIGSEGV, mySIGSEGVorSIGBUScatcher);
#if BZ_UNIX
! #ifdef SIGBUS
signal (SIGBUS, mySIGSEGVorSIGBUScatcher);
#endif
#endif
copyFileName ( inName, "(none)" );
copyFileName ( outName, "(none)" );
diff -aprNC7 bzip2-0.9.5d.orig/bzip2recover.c
bzip2-0.9.5d.djgpp/bzip2recover.c
*** bzip2-0.9.5d.orig/bzip2recover.c Sat Sep 4 22:24:34 1999
--- bzip2-0.9.5d.djgpp/bzip2recover.c Mon Oct 18 18:39:56 1999
***************
*** 52,65 ****
--- 52,68 ----
properly. It isn't very complicated.
--*/
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+ #ifdef __DJGPP__
+ #include <fcntl.h>
+ #endif
typedef unsigned int UInt32;
typedef int Int32;
typedef unsigned char UChar;
typedef char Char;
typedef unsigned char Bool;
#define True ((Bool)1)
*************** typedef unsigned char Bool;
*** 69,82 ****
--- 72,92 ----
Char inFileName[2000];
Char outFileName[2000];
Char progName[2000];
UInt32 bytesOut = 0;
UInt32 bytesIn = 0;
+ #ifdef __DJGPP__
+ #define HAVE_LFN_SUPPORT (_USE_LFN)
+ #define NO_LFN_SUPPORT (!HAVE_LFN_SUPPORT)
+ #define HAS_NO_EXTENSION(filename) (strchr ((filename), '.') ==
NULL)
+ int _stklen = 524288;
+ #endif
+
/*---------------------------------------------------*/
/*--- I/O errors ---*/
/*---------------------------------------------------*/
/*---------------------------------------------*/
void readError ( void )
*************** void bsPutBit ( BitStream* bs, Int32 bit
*** 178,192 ****
--*/
Int32 bsGetBit ( BitStream* bs )
{
if (bs->buffLive > 0) {
bs->buffLive --;
return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 );
} else {
! Int32 retVal = getc ( bs->handle );
if ( retVal == EOF ) {
if (errno != 0) readError();
return 2;
}
bs->buffLive = 7;
bs->buffer = retVal;
return ( ((bs->buffer) >> 7) & 0x1 );
--- 188,205 ----
--*/
Int32 bsGetBit ( BitStream* bs )
{
if (bs->buffLive > 0) {
bs->buffLive --;
return ( ((bs->buffer) >> (bs->buffLive)) & 0x1 );
} else {
! Int32 retVal;
! errno = 0; /* to avoid program abort with (ENOENT).
! errno=22 is generated in main by fopen. */
! retVal = getc ( bs->handle );
if ( retVal == EOF ) {
if (errno != 0) readError();
return 2;
}
bs->buffLive = 7;
bs->buffer = retVal;
return ( ((bs->buffer) >> 7) & 0x1 );
*************** Int32 main ( Int32 argc, Char** argv )
*** 397,414 ****
bsClose ( bsWr );
}
if (wrBlock >= rbCtr) break;
wrBlock++;
} else
if (bitsRead == rbStart[wrBlock]) {
outFileName[0] = 0;
! sprintf ( outFileName, "rec%4d", wrBlock+1 );
for (p = outFileName; *p != 0; p++) if (*p == ' ') *p =
'0';
strcat ( outFileName, inFileName );
! if ( !endsInBz2(outFileName)) strcat ( outFileName, ".bz2"
);
fprintf ( stderr, " writing block %d to `%s' ...\n",
wrBlock+1, outFileName );
outFile = fopen ( outFileName, "wb" );
if (outFile == NULL) {
fprintf ( stderr, "%s: can't write `%s'\n",
--- 410,437 ----
bsClose ( bsWr );
}
if (wrBlock >= rbCtr) break;
wrBlock++;
} else
if (bitsRead == rbStart[wrBlock]) {
outFileName[0] = 0;
! #ifdef __DJGPP__
! if (NO_LFN_SUPPORT) /* There are only 8 characters
available. */
! sprintf ( outFileName, "r%4d", wrBlock+1 );
! else
! #endif
! sprintf ( outFileName, "rec%4d", wrBlock+1 );
for (p = outFileName; *p != 0; p++) if (*p == ' ') *p =
'0';
strcat ( outFileName, inFileName );
! #ifdef __DJGPP__
! if (NO_LFN_SUPPORT && HAS_NO_EXTENSION(outFileName))
! strcat (outFileName, ".b");
! else if (HAVE_LFN_SUPPORT) /* Only if LFN support is
available, append an extra extension. */
! #endif
! if ( !endsInBz2(outFileName)) strcat ( outFileName,
".bz2" );
fprintf ( stderr, " writing block %d to `%s' ...\n",
wrBlock+1, outFileName );
outFile = fopen ( outFileName, "wb" );
if (outFile == NULL) {
fprintf ( stderr, "%s: can't write `%s'\n",
diff -aprNC7 bzip2-0.9.5d.orig/manual.texi
bzip2-0.9.5d.djgpp/manual.texi
*** bzip2-0.9.5d.orig/manual.texi Sat Sep 4 22:14:38 1999
--- bzip2-0.9.5d.djgpp/manual.texi Mon Oct 18 18:39:56 1999
*************** above statement.
*** 93,107 ****
! @node Overview, Implementation, Top, Top
@chapter Introduction
@code{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.
--- 93,107 ----
! @node Overview, , Top, (dir)
@chapter Introduction
@code{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.
*************** ought to be recorded somewhere.
*** 124,148 ****
This chapter contains a copy of the @code{bzip2} man page,
and nothing else.
@quotation
@unnumberedsubsubsec NAME
! @itemize
@item @code{bzip2}, @code{bunzip2}
! - a block-sorting file compressor, v0.9.5
@item @code{bzcat}
! - decompresses files to stdout
@item @code{bzip2recover}
! - recovers data from damaged bzip2 files
@end itemize
@unnumberedsubsubsec SYNOPSIS
! @itemize
@item @code{bzip2} [ -cdfkqstvzVL123456789 ] [ filenames ... ]
@item @code{bunzip2} [ -fkvsVL ] [ filenames ... ]
@item @code{bzcat} [ -s ] [ filenames ... ]
@item @code{bzip2recover} filename
@end itemize
@unnumberedsubsubsec DESCRIPTION
--- 124,148 ----
This chapter contains a copy of the @code{bzip2} man page,
and nothing else.
@quotation
@unnumberedsubsubsec NAME
! @itemize @minus
@item @code{bzip2}, @code{bunzip2}
! a block-sorting file compressor, v0.9.5
@item @code{bzcat}
! decompresses files to stdout
@item @code{bzip2recover}
! recovers data from damaged bzip2 files
@end itemize
@unnumberedsubsubsec SYNOPSIS
! @itemize @minus
@item @code{bzip2} [ -cdfkqstvzVL123456789 ] [ filenames ... ]
@item @code{bunzip2} [ -fkvsVL ] [ filenames ... ]
@item @code{bzcat} [ -s ] [ filenames ... ]
@item @code{bzip2recover} filename
@end itemize
@unnumberedsubsubsec DESCRIPTION
*************** write compressed output to a terminal, a
*** 175,201 ****
incomprehensible and therefore pointless.
@code{bunzip2} (or @code{bzip2 -d}) decompresses all
specified files. Files which were not created by @code{bzip2}
will be detected and ignored, and a warning issued.
@code{bzip2} attempts to guess the filename for the decompressed
file
from that of the compressed file as follows:
! @itemize
@item @code{filename.bz2 } becomes @code{filename}
@item @code{filename.bz } becomes @code{filename}
@item @code{filename.tbz2} becomes @code{filename.tar}
@item @code{filename.tbz } becomes @code{filename.tar}
@item @code{anyothername } becomes @code{anyothername.out}
@end itemize
If the file does not end in one of the recognised endings,
@code{.bz2}, @code{.bz},
@code{.tbz2} or @code{.tbz}, @code{bzip2} complains that it cannot
guess the name of the original file, and uses the original name
with @code{.out} appended.
As with compression, supplying no
filenames causes decompression from standard input to standard
output.
@code{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 (@code{-t}) of concatenated compressed files is also
supported.
--- 175,223 ----
incomprehensible and therefore pointless.
@code{bunzip2} (or @code{bzip2 -d}) decompresses all
specified files. Files which were not created by @code{bzip2}
will be detected and ignored, and a warning issued.
@code{bzip2} attempts to guess the filename for the decompressed
file
from that of the compressed file as follows:
! @itemize @bullet
@item @code{filename.bz2 } becomes @code{filename}
@item @code{filename.bz } becomes @code{filename}
@item @code{filename.tbz2} becomes @code{filename.tar}
@item @code{filename.tbz } becomes @code{filename.tar}
@item @code{anyothername } becomes @code{anyothername.out}
@end itemize
+
If the file does not end in one of the recognised endings,
@code{.bz2}, @code{.bz},
@code{.tbz2} or @code{.tbz}, @code{bzip2} complains that it cannot
guess the name of the original file, and uses the original name
with @code{.out} appended.
+ The above applies also to the MSDOS port of @code{bzip2} when LFN
support is avaliable.
+ If LFN support is not available then the following naming
convention applies:
+
+ At compression time:
+ @itemize @bullet
+ @item @code{filename } becomes @code{filename.b}
+ @item @code{filename.e } becomes @code{filename.eb}
+ @item @code{filename.ex } becomes @code{filename.exb}
+ @item @code{filename.ext} becomes @code{filename.exb}
+ @item @code{filename.tar} becomes @code{filename.tbz}
+ @end itemize
+
+ And at decompression time:
+ @itemize @bullet
+ @item @code{filename.b } becomes @code{filename}
+ @item @code{filename.eb } becomes @code{filename.e}
+ @item @code{filename.exb} becomes @code{filename.ex}
+ @item @code{filename.tbz} becomes @code{filename.tar}
+ @item @code{anyothername} becomes @code{anyothername.out}
+ @end itemize
+
As with compression, supplying no
filenames causes decompression from standard input to standard
output.
@code{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 (@code{-t}) of concatenated compressed files is also
supported.
*************** and writes a number of files @code{rec00
*** 397,410 ****
--- 419,440 ----
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.
+ For the MSDOS port of @code{bzip2recover} the following naming
convention applies:
+
+ If LFN support is available the output file names will be of the
+ same form as above described. If LFN support is not available then
@code{rec0001file}
+ becomes @code{r0001file}, etc. If the file has no extension then an
@code{.b} extension
+ is added, else the original extension is preserved.
+
+
@unnumberedsubsubsec 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
*************** This interface provides functions for re
*** 1131,1145 ****
@subsection @code{bzReadOpen}
@example
typedef void BZFILE;
BZFILE *bzReadOpen ( int *bzerror, FILE *f,
! int small, int verbosity,
void *unused, int nUnused );
@end example
Prepare to read compressed data from file handle @code{f}.
@code{f}
should refer to a file which has been opened for reading, and for
which
the error indicator (@code{ferror(f)})is not set. If @code{small}
is 1,
the library will try to decompress using less memory, at the
expense of
speed.
--- 1161,1175 ----
@subsection @code{bzReadOpen}
@example
typedef void BZFILE;
BZFILE *bzReadOpen ( int *bzerror, FILE *f,
! int verbosity, int small,
void *unused, int nUnused );
@end example
Prepare to read compressed data from file handle @code{f}.
@code{f}
should refer to a file which has been opened for reading, and for
which
the error indicator (@code{ferror(f)})is not set. If @code{small}
is 1,
the library will try to decompress using less memory, at the
expense of
speed.
*************** char buf[ /* whatever size you like *
*** 1511,1525 ****
int bzerror;
int nWritten;
f = fopen ( "myfile.bz2", "r" );
if (!f) @{
/* handle error */
@}
! b = bzReadOpen ( &bzerror, f, 0, NULL, 0 );
if (bzerror != BZ_OK) @{
bzReadClose ( &bzerror, b );
/* handle error */
@}
bzerror = BZ_OK;
while (bzerror == BZ_OK && /* arbitrary other conditions */) @{
--- 1541,1555 ----
int bzerror;
int nWritten;
f = fopen ( "myfile.bz2", "r" );
if (!f) @{
/* handle error */
@}
! b = bzReadOpen ( &bzerror, f, 0, 0, NULL, 0 );
if (bzerror != BZ_OK) @{
bzReadClose ( &bzerror, b );
/* handle error */
@}
bzerror = BZ_OK;
while (bzerror == BZ_OK && /* arbitrary other conditions */) @{
- Raw text -