diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 07:48:04 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 07:48:04 +0000 |
commit | 5682f60e459bbb6a0d6174377db327fa5b63710b (patch) | |
tree | 94ea4904226e2a6b93fda7a50c96659f37f34458 | |
parent | Adding debian version 1.7-3. (diff) | |
download | lzip-5682f60e459bbb6a0d6174377db327fa5b63710b.tar.xz lzip-5682f60e459bbb6a0d6174377db327fa5b63710b.zip |
Merging upstream version 1.8.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
-rw-r--r-- | AUTHORS | 4 | ||||
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | INSTALL | 2 | ||||
-rw-r--r-- | Makefile.in | 28 | ||||
-rw-r--r-- | NEWS | 11 | ||||
-rw-r--r-- | README | 8 | ||||
-rwxr-xr-x | configure | 4 | ||||
-rw-r--r-- | decoder.cc | 19 | ||||
-rw-r--r-- | decoder.h | 1 | ||||
-rw-r--r-- | doc/lzdiff.1 | 48 | ||||
-rw-r--r-- | doc/lzgrep.1 | 42 | ||||
-rw-r--r-- | doc/lzip.1 | 4 | ||||
-rw-r--r-- | doc/lzip.info | 127 | ||||
-rw-r--r-- | doc/lzip.texinfo | 110 | ||||
-rw-r--r-- | doc/lziprecover.1 | 4 | ||||
-rw-r--r-- | encoder.cc | 50 | ||||
-rw-r--r-- | encoder.h | 32 | ||||
-rwxr-xr-x | lzdiff | 152 | ||||
-rwxr-xr-x | lzgrep | 135 | ||||
-rw-r--r-- | main.cc | 14 | ||||
-rwxr-xr-x | testsuite/check.sh | 12 | ||||
-rw-r--r-- | testsuite/unzcrash.cc | 2 |
22 files changed, 125 insertions, 691 deletions
@@ -1,4 +1,4 @@ Lzip was written by Antonio Diaz Diaz. -Lzip implements a simplified version of the LZMA algorithm. The original -LZMA algorithm was designed by Igor Pavlov. +Lzip implements a simplified version of the LZMA algorithm. +The original LZMA algorithm was designed by Igor Pavlov. @@ -1,3 +1,10 @@ +2009-09-02 Antonio Diaz Diaz <ant_diaz@teleline.es> + + * Version 1.8 released. + * Compression time has been reduced by 4%. + * Lzdiff and lzgrep have been moved to the new package zutils. + * Fixed warnings on sistems where uint32_t != unsigned int. + 2009-06-25 Antonio Diaz Diaz <ant_diaz@teleline.es> * Version 1.7 released. @@ -1,7 +1,7 @@ Requirements ------------ You will need a C++ compiler. -I use gcc 4.3.3 and 3.3.6, but the code should compile with any +I use gcc 4.3.4 and 3.3.6, but the code should compile with any standards compliant compiler. Gcc is available at http://gcc.gnu.org. diff --git a/Makefile.in b/Makefile.in index decce04..3062c4e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2,8 +2,8 @@ DISTNAME = $(progname)-$(progversion) INSTALL = install INSTALL_PROGRAM = $(INSTALL) -p -m 755 -INSTALL_SCRIPT = $(INSTALL) -p -m 755 INSTALL_DATA = $(INSTALL) -p -m 644 +INSTALL_DIR = $(INSTALL) -d -m 755 SHELL = /bin/sh objs = arg_parser.o decoder.o encoder.o main.o @@ -47,14 +47,7 @@ info : $(VPATH)/doc/$(progname).info $(VPATH)/doc/$(progname).info : $(VPATH)/doc/$(progname).texinfo cd $(VPATH)/doc && makeinfo $(progname).texinfo -man : $(VPATH)/doc/lzdiff.1 $(VPATH)/doc/lzgrep.1 \ - $(VPATH)/doc/$(progname).1 $(VPATH)/doc/lziprecover.1 - -$(VPATH)/doc/lzdiff.1 : $(VPATH)/lzdiff - help2man -o $(VPATH)/doc/lzdiff.1 --no-info $(VPATH)/lzdiff - -$(VPATH)/doc/lzgrep.1 : $(VPATH)/lzgrep - help2man -o $(VPATH)/doc/lzgrep.1 --no-info $(VPATH)/lzgrep +man : $(VPATH)/doc/$(progname).1 $(VPATH)/doc/lziprecover.1 $(VPATH)/doc/$(progname).1 : $(progname) help2man -o $(VPATH)/doc/$(progname).1 ./$(progname) @@ -69,21 +62,17 @@ check : all $(VPATH)/testsuite/check.sh @$(VPATH)/testsuite/check.sh $(VPATH)/testsuite install : all install-info install-man - if test ! -d $(DESTDIR)$(bindir) ; then $(INSTALL) -d $(DESTDIR)$(bindir) ; fi - $(INSTALL_SCRIPT) $(VPATH)/lzdiff $(DESTDIR)$(bindir)/lzdiff - $(INSTALL_SCRIPT) $(VPATH)/lzgrep $(DESTDIR)$(bindir)/lzgrep + if test ! -d $(DESTDIR)$(bindir) ; then $(INSTALL_DIR) $(DESTDIR)$(bindir) ; fi $(INSTALL_PROGRAM) ./$(progname) $(DESTDIR)$(bindir)/$(progname) $(INSTALL_PROGRAM) ./lziprecover $(DESTDIR)$(bindir)/lziprecover install-info : - if test ! -d $(DESTDIR)$(infodir) ; then $(INSTALL) -d $(DESTDIR)$(infodir) ; fi + if test ! -d $(DESTDIR)$(infodir) ; then $(INSTALL_DIR) $(DESTDIR)$(infodir) ; fi $(INSTALL_DATA) $(VPATH)/doc/$(progname).info $(DESTDIR)$(infodir)/$(progname).info -install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$(progname).info install-man : - if test ! -d $(DESTDIR)$(mandir)/man1 ; then $(INSTALL) -d $(DESTDIR)$(mandir)/man1 ; fi - $(INSTALL_DATA) $(VPATH)/doc/lzdiff.1 $(DESTDIR)$(mandir)/man1/lzdiff.1 - $(INSTALL_DATA) $(VPATH)/doc/lzgrep.1 $(DESTDIR)$(mandir)/man1/lzgrep.1 + if test ! -d $(DESTDIR)$(mandir)/man1 ; then $(INSTALL_DIR) $(DESTDIR)$(mandir)/man1 ; fi $(INSTALL_DATA) $(VPATH)/doc/$(progname).1 $(DESTDIR)$(mandir)/man1/$(progname).1 $(INSTALL_DATA) $(VPATH)/doc/lziprecover.1 $(DESTDIR)$(mandir)/man1/lziprecover.1 @@ -91,8 +80,6 @@ install-strip : all $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install uninstall : uninstall-info uninstall-man - -rm -f $(DESTDIR)$(bindir)/lzdiff - -rm -f $(DESTDIR)$(bindir)/lzgrep -rm -f $(DESTDIR)$(bindir)/$(progname) -rm -f $(DESTDIR)$(bindir)/lziprecover @@ -102,6 +89,7 @@ uninstall-info : uninstall-man : -rm -f $(DESTDIR)$(mandir)/man1/$(progname).1 + -rm -f $(DESTDIR)$(mandir)/man1/lziprecover.1 dist : ln -sf $(VPATH) $(DISTNAME) @@ -114,14 +102,10 @@ dist : $(DISTNAME)/NEWS \ $(DISTNAME)/README \ $(DISTNAME)/configure \ - $(DISTNAME)/doc/lzdiff.1 \ - $(DISTNAME)/doc/lzgrep.1 \ $(DISTNAME)/doc/$(progname).1 \ $(DISTNAME)/doc/$(progname).info \ $(DISTNAME)/doc/$(progname).texinfo \ $(DISTNAME)/doc/lziprecover.1 \ - $(DISTNAME)/lzdiff \ - $(DISTNAME)/lzgrep \ $(DISTNAME)/testsuite/COPYING.lz \ $(DISTNAME)/testsuite/check.sh \ $(DISTNAME)/testsuite/unzcrash.cc \ @@ -1,5 +1,8 @@ -Changes in version 1.7: +Changes in version 1.8: -A bug, introduced in version 1.6, which prevents lzip from decompressing -some rare files has been fixed. The integrity checking code catches it, -so there is no risk of data loss. +Compression time has been reduced by 4%. + +Lzdiff and lzgrep have been moved to the new package zutils. + +Compilation warnings on sistems where uint32_t != unsigned int have been +fixed. @@ -29,10 +29,10 @@ compressed output in volumes of a given size, even when reading from standard input. This allows the direct creation of multivolume compressed tar archives. -Lzip will automatically use the smallest possible dictionary size for -each member without exceeding the given limit. It is important to -appreciate that the decompression memory requirement is affected at -compression time by the choice of dictionary size limit. +Lzip will automatically use the smallest possible dictionary size +without exceeding the given limit. It is important to appreciate that +the decompression memory requirement is affected at compression time by +the choice of dictionary size limit. As a self-check for your protection, lzip stores in the member trailer the 32-bit CRC of the original data and the size of the original data, @@ -5,13 +5,13 @@ # This configure script is free software: you have unlimited permission # to copy, distribute and modify it. # -# Date of this version: 2009-06-25 +# Date of this version: 2009-09-02 invocation_name=$0 args= no_create= progname=lzip -progversion=1.7 +progversion=1.8 srctrigger=lzip.h # clear some things potentially inherited from environment. @@ -80,6 +80,15 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp ) const } } if( format_version == 0 ) trailer.member_size( member_position() ); + if( !range_decoder.code_is_zero() ) + { + error = true; + if( verbosity >= 0 ) + { + pp(); + std::fprintf( stderr, "range_decoder final code is not zero.\n" ); + } + } if( trailer.data_crc() != crc() ) { error = true; @@ -87,7 +96,7 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp ) const { pp(); std::fprintf( stderr, "crc mismatch; trailer says %08X, data crc is %08X.\n", - trailer.data_crc(), crc() ); + (unsigned int)trailer.data_crc(), (unsigned int)crc() ); } } if( trailer.data_size() != data_position() ) @@ -116,7 +125,8 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp ) const } if( !error && verbosity >= 3 ) std::fprintf( stderr, "data crc %08X, data size %8lld, member size %8lld. ", - trailer.data_crc(), trailer.data_size(), trailer.member_size() ); + (unsigned int)trailer.data_crc(), trailer.data_size(), + trailer.member_size() ); return !error; } @@ -137,10 +147,11 @@ int LZ_decoder::decode_member( const Pretty_print & pp ) const int pos_state = data_position() & pos_state_mask; if( range_decoder.decode_bit( bm_match[state()][pos_state] ) == 0 ) { + const uint8_t prev_byte = get_byte( 0 ); if( state.is_char() ) - put_byte( literal_decoder.decode( range_decoder, get_byte( 0 ) ) ); + put_byte( literal_decoder.decode( range_decoder, prev_byte ) ); else - put_byte( literal_decoder.decode_matched( range_decoder, get_byte( 0 ), + put_byte( literal_decoder.decode_matched( range_decoder, prev_byte, get_byte( rep0 ) ) ); state.set_char(); } @@ -63,6 +63,7 @@ public: ibuf( buf ) { for( int i = 0; i < 5; ++i ) code = (code << 8) | get_byte(); } + bool code_is_zero() const throw() { return ( code == 0 ); } bool finished() const throw() { return ibuf.finished(); } long long member_position() const throw() { return member_pos; } diff --git a/doc/lzdiff.1 b/doc/lzdiff.1 deleted file mode 100644 index b531605..0000000 --- a/doc/lzdiff.1 +++ /dev/null @@ -1,48 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH LZDIFF "1" "May 2009" "Lzdiff 0.5" "User Commands" -.SH NAME -Lzdiff \- manual page for Lzdiff 0.5 -.SH SYNOPSIS -.B lzdiff -[\fIOPTIONS\fR] [\fIDIFF_OPTIONS\fR] \fIFILE1 \fR[\fIFILE2\fR] -.SH DESCRIPTION -Lzdiff \- Diff/cmp wrapper for compressed files. -.PP -Lzdiff is a wrapper script around the diff and cmp commands that allows -transparent comparison of any combination of compressed and -non\-compressed files. If any given file is compressed, its uncompressed -content is used. The supported compressors are gzip, bzip2 and lzip. -.PP -Compares FILE1 to FILE2. If FILE2 is omitted, compares FILE1 to the -uncompressed contents of FILE1.[gz|bz2|lz] (depending on the default -compressor selected). DIFF_OPTIONS are passed directly to diff or cmp. -The exit status from diff or cmp is preserved. -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -display this help and exit -.TP -\fB\-V\fR, \fB\-\-version\fR -output version information and exit -.TP -\fB\-\-gzip\fR -use gzip as default decompressor -.TP -\fB\-\-bzip2\fR -use bzip2 as default decompressor -.TP -\fB\-\-lzip\fR -use lzip as default decompressor (default) -.TP -\fB\-\-diff\fR -use diff to compare files (default) -.TP -\fB\-\-cmp\fR -use cmp to compare files -.SH "REPORTING BUGS" -Report bugs to lzip\-bug@nongnu.org -Lzip home page: http://www.nongnu.org/lzip/lzip.html -.SH COPYRIGHT -Copyright \(co 2009 Antonio Diaz Diaz. -This script is free software: you have unlimited permission -to copy, distribute and modify it. diff --git a/doc/lzgrep.1 b/doc/lzgrep.1 deleted file mode 100644 index b4d7183..0000000 --- a/doc/lzgrep.1 +++ /dev/null @@ -1,42 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH LZGREP "1" "May 2009" "Lzgrep 0.5" "User Commands" -.SH NAME -Lzgrep \- manual page for Lzgrep 0.5 -.SH SYNOPSIS -.B lzgrep -[\fIOPTIONS\fR] [\fIGREP_OPTIONS\fR] \fIPATTERN \fR[\fIFILES\fR] -.SH DESCRIPTION -Lzgrep \- Grep wrapper for compressed files. -.PP -Lzgrep is a wrapper script around the grep command that allows -transparent search on any combination of compressed and non\-compressed -files. If any given file is compressed, its uncompressed content is -used. If a given file does not exist, lzgrep tries the compressed file -name corresponding to the default compressor selected. The supported -compressors are gzip, bzip2 and lzip. -.PP -GREP_OPTIONS are passed directly to grep. -The exit status from grep is preserved. -.SH OPTIONS -.TP -\fB\-h\fR, \fB\-\-help\fR -display this help and exit -.TP -\fB\-V\fR, \fB\-\-version\fR -output version information and exit -.TP -\fB\-\-gzip\fR -use gzip as default decompressor -.TP -\fB\-\-bzip2\fR -use bzip2 as default decompressor -.TP -\fB\-\-lzip\fR -use lzip as default decompressor (default) -.SH "REPORTING BUGS" -Report bugs to lzip\-bug@nongnu.org -Lzip home page: http://www.nongnu.org/lzip/lzip.html -.SH COPYRIGHT -Copyright \(co 2009 Antonio Diaz Diaz. -This script is free software: you have unlimited permission -to copy, distribute and modify it. @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH LZIP "1" "June 2009" "Lzip 1.7" "User Commands" +.TH LZIP "1" "September 2009" "Lzip 1.8" "User Commands" .SH NAME -Lzip \- manual page for Lzip 1.7 +Lzip \- manual page for Lzip 1.8 .SH SYNOPSIS .B lzip [\fIoptions\fR] [\fIfiles\fR] diff --git a/doc/lzip.info b/doc/lzip.info index 31080a8..282cc03 100644 --- a/doc/lzip.info +++ b/doc/lzip.info @@ -11,7 +11,7 @@ File: lzip.info, Node: Top, Next: Introduction, Up: (dir) Lzip **** -This manual is for Lzip (version 1.7, 25 June 2009). +This manual is for Lzip (version 1.8, 2 September 2009). * Menu: @@ -20,8 +20,6 @@ This manual is for Lzip (version 1.7, 25 June 2009). * Invoking Lzip:: Command line interface * File Format:: Detailed format of the compressed file * Examples:: A small tutorial with examples -* Lzdiff:: Comparing compressed files -* Lzgrep:: Searching inside compressed files * Lziprecover:: Recovering data from damaged compressed files * Problems:: Reporting bugs * Concept Index:: Index of concepts @@ -72,9 +70,9 @@ or 2 times the dictionary size limit (1 if input file size is less than dictionary size limit, else 2) plus 8 times the dictionary size really used. For decompression is a little more than the dictionary size really used. Lzip will automatically use the smallest possible dictionary size -for each member without exceeding the given limit. It is important to -appreciate that the decompression memory requirement is affected at -compression time by the choice of dictionary size limit. +without exceeding the given limit. It is important to appreciate that +the decompression memory requirement is affected at compression time by +the choice of dictionary size limit. When decompressing, lzip attempts to guess the name for the decompressed file from that of the compressed file as follows: @@ -350,7 +348,7 @@ additional information before, between, or after them. -File: lzip.info, Node: Examples, Next: Lzdiff, Prev: File Format, Up: Top +File: lzip.info, Node: Examples, Next: Lziprecover, Prev: File Format, Up: Top 5 A small tutorial with examples ******************************** @@ -411,98 +409,9 @@ second copy. (Indented lines are lzip error messages). cat rec*big_database1_00001.lz > big_database3_00001.lz -File: lzip.info, Node: Lzdiff, Next: Lzgrep, Prev: Examples, Up: Top +File: lzip.info, Node: Lziprecover, Next: Problems, Prev: Examples, Up: Top -6 Lzdiff -******** - -Lzdiff is a wrapper script around the diff and cmp commands that allows -transparent comparison of any combination of compressed and -non-compressed files. If any given file is compressed, its uncompressed -content is used. The supported compressors are gzip, bzip2 and lzip. - - The format for running lzdiff is: - - lzdiff [OPTIONS] [DIFF_OPTIONS] FILE1 [FILE2] - -Compares FILE1 to FILE2. If FILE2 is omitted, compares FILE1 to the -uncompressed contents of FILE1.[gz|bz2|lz] (depending on the default -compressor selected). DIFF_OPTIONS are passed directly to diff or cmp. -The exit status from diff or cmp is preserved. - - Lzdiff supports the following options: - -`--help' -`-h' - Print an informative help message describing the options and exit. - -`--version' -`-V' - Print the version number of lzdiff on the standard output and exit. - -`--gzip' - Use gzip as default decompressor. - -`--bzip2' - Use bzip2 as default decompressor. - -`--lzip' - Use lzip as default decompressor (default). - -`--diff' - Use diff to compare files (default). - -`--cmp' - Use cmp to compare files. - - - Lzdiff has the limitation that messages from the diff or cmp programs -refer to temporary filenames instead of those specified. - - -File: lzip.info, Node: Lzgrep, Next: Lziprecover, Prev: Lzdiff, Up: Top - -7 Lzgrep -******** - -Lzgrep is a wrapper script around the grep command that allows -transparent search on any combination of compressed and non-compressed -files. If any given file is compressed, its uncompressed content is -used. If a given file does not exist, lzgrep tries the compressed file -name corresponding to the default compressor selected. The supported -compressors are gzip, bzip2 and lzip. - - The format for running lzgrep is: - - lzgrep [OPTIONS] [GREP_OPTIONS] PATTERN [FILES] - -GREP_OPTIONS are passed directly to grep. The exit status from grep is -preserved. - - Lzgrep supports the following options: - -`--help' -`-h' - Print an informative help message describing the options and exit. - -`--version' -`-V' - Print the version number of lzgrep on the standard output and exit. - -`--gzip' - Use gzip as default decompressor. - -`--bzip2' - Use bzip2 as default decompressor. - -`--lzip' - Use lzip as default decompressor (default). - - - -File: lzip.info, Node: Lziprecover, Next: Problems, Prev: Lzgrep, Up: Top - -8 Lziprecover +6 Lziprecover ************* Lziprecover is a program that searches for members in .lz files, and @@ -520,7 +429,7 @@ correct order. File: lzip.info, Node: Problems, Next: Concept Index, Prev: Lziprecover, Up: Top -9 Reporting Bugs +7 Reporting Bugs **************** There are probably bugs in lzip. There are certainly errors and @@ -548,8 +457,6 @@ Concept Index * getting help: Problems. (line 6) * introduction: Introduction. (line 6) * invoking: Invoking Lzip. (line 6) -* lzdiff: Lzdiff. (line 6) -* lzgrep: Lzgrep. (line 6) * lziprecover: Lziprecover. (line 6) * options: Invoking Lzip. (line 6) * usage: Invoking Lzip. (line 6) @@ -559,15 +466,13 @@ Concept Index Tag Table: Node: Top224 -Node: Introduction961 -Node: Algorithm4284 -Node: Invoking Lzip6510 -Node: File Format10857 -Node: Examples12811 -Node: Lzdiff14644 -Node: Lzgrep15963 -Node: Lziprecover16998 -Node: Problems17695 -Node: Concept Index18220 +Node: Introduction880 +Node: Algorithm4187 +Node: Invoking Lzip6413 +Node: File Format10760 +Node: Examples12714 +Node: Lziprecover14552 +Node: Problems15251 +Node: Concept Index15776 End Tag Table diff --git a/doc/lzip.texinfo b/doc/lzip.texinfo index a17cded..adb5eb6 100644 --- a/doc/lzip.texinfo +++ b/doc/lzip.texinfo @@ -5,8 +5,8 @@ @finalout @c %**end of header -@set UPDATED 25 June 2009 -@set VERSION 1.7 +@set UPDATED 2 September 2009 +@set VERSION 1.8 @dircategory Data Compression @direntry @@ -37,8 +37,6 @@ This manual is for Lzip (version @value{VERSION}, @value{UPDATED}). * Invoking Lzip:: Command line interface * File Format:: Detailed format of the compressed file * Examples:: A small tutorial with examples -* Lzdiff:: Comparing compressed files -* Lzgrep:: Searching inside compressed files * Lziprecover:: Recovering data from damaged compressed files * Problems:: Reporting bugs * Concept Index:: Index of concepts @@ -89,9 +87,9 @@ times the dictionary size limit (1 if input file size is less than dictionary size limit, else 2) plus 8 times the dictionary size really used. For decompression is a little more than the dictionary size really used. Lzip will automatically use the smallest possible dictionary size -for each member without exceeding the given limit. It is important to -appreciate that the decompression memory requirement is affected at -compression time by the choice of dictionary size limit. +without exceeding the given limit. It is important to appreciate that +the decompression memory requirement is affected at compression time by +the choice of dictionary size limit. When decompressing, lzip attempts to guess the name for the decompressed file from that of the compressed file as follows: @@ -461,104 +459,6 @@ cat rec*big_database1_00001.lz > big_database3_00001.lz @end example -@node Lzdiff -@chapter Lzdiff -@cindex lzdiff - -Lzdiff is a wrapper script around the diff and cmp commands that allows -transparent comparison of any combination of compressed and -non-compressed files. If any given file is compressed, its uncompressed -content is used. The supported compressors are gzip, bzip2 and lzip. - -The format for running lzdiff is: - -@example -lzdiff [@var{options}] [@var{diff_options}] @var{file1} [@var{file2}] -@end example - -@noindent -Compares @var{file1} to @var{file2}. If @var{file2} is omitted, compares -@var{file1} to the uncompressed contents of @var{file1}.[gz|bz2|lz] -(depending on the default compressor selected). @var{diff_options} are -passed directly to diff or cmp. The exit status from diff or cmp is -preserved. - -Lzdiff supports the following options: - -@table @samp -@item --help -@itemx -h -Print an informative help message describing the options and exit. - -@item --version -@itemx -V -Print the version number of lzdiff on the standard output and exit. - -@item --gzip -Use gzip as default decompressor. - -@item --bzip2 -Use bzip2 as default decompressor. - -@item --lzip -Use lzip as default decompressor (default). - -@item --diff -Use diff to compare files (default). - -@item --cmp -Use cmp to compare files. - -@end table - -Lzdiff has the limitation that messages from the diff or cmp programs -refer to temporary filenames instead of those specified. - - -@node Lzgrep -@chapter Lzgrep -@cindex lzgrep - -Lzgrep is a wrapper script around the grep command that allows -transparent search on any combination of compressed and non-compressed -files. If any given file is compressed, its uncompressed content is -used. If a given file does not exist, lzgrep tries the compressed file -name corresponding to the default compressor selected. The supported -compressors are gzip, bzip2 and lzip. - -The format for running lzgrep is: - -@example -lzgrep [@var{options}] [@var{grep_options}] @var{pattern} [@var{files}] -@end example - -@noindent -@var{grep_options} are passed directly to grep. The exit status from -grep is preserved. - -Lzgrep supports the following options: - -@table @samp -@item --help -@itemx -h -Print an informative help message describing the options and exit. - -@item --version -@itemx -V -Print the version number of lzgrep on the standard output and exit. - -@item --gzip -Use gzip as default decompressor. - -@item --bzip2 -Use bzip2 as default decompressor. - -@item --lzip -Use lzip as default decompressor (default). - -@end table - - @node Lziprecover @chapter Lziprecover @cindex lziprecover diff --git a/doc/lziprecover.1 b/doc/lziprecover.1 index 37c2ac2..80dc3b3 100644 --- a/doc/lziprecover.1 +++ b/doc/lziprecover.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.36. -.TH LZIPRECOVER "1" "June 2009" "Lziprecover 1.7" "User Commands" +.TH LZIPRECOVER "1" "September 2009" "Lziprecover 1.8" "User Commands" .SH NAME -Lziprecover \- manual page for Lziprecover 1.7 +Lziprecover \- manual page for Lziprecover 1.8 .SH SYNOPSIS .B lziprecover [\fIoptions\fR] \fIfile\fR @@ -47,7 +47,6 @@ Matchfinder::Matchfinder( const int dict_size, const int len_limit, const int ides ) : partial_data_pos( 0 ), - after_size( max_match_len ), pos( 0 ), cyclic_pos( 0 ), stream_pos( 0 ), @@ -56,7 +55,7 @@ Matchfinder::Matchfinder( const int dict_size, const int len_limit, prev_positions( new int32_t[num_prev_positions] ), at_stream_end( false ) { - const int buffer_size_limit = ( 2 * dict_size ) + max_num_trials + after_size; + const int buffer_size_limit = ( 2 * dict_size ) + before_size + after_size; buffer_size = std::max( 65536, dict_size ); buffer = (uint8_t *)std::malloc( buffer_size ); if( !buffer ) throw std::bad_alloc(); @@ -99,7 +98,7 @@ bool Matchfinder::move_pos() throw() if( pos > stream_pos ) { pos = stream_pos; return false; } if( !at_stream_end ) { - const int offset = pos - dictionary_size_ - max_num_trials; + const int offset = pos - dictionary_size_ - before_size; const int size = stream_pos - offset; std::memmove( buffer, buffer + offset, size ); partial_data_pos += offset; @@ -156,14 +155,13 @@ int Matchfinder::longest_match_len( int * const distances ) throw() int idx0 = cyclic_pos << 1; int idx1 = idx0 + 1; - int len0 = 0, len1 = 0; + int len = 0, len0 = 0, len1 = 0; for( int count = 16 + ( match_len_limit_ / 2 ); ; ) { if( newpos < min_pos || --count < 0 ) { prev_pos_tree[idx0] = prev_pos_tree[idx1] = -1; break; } const uint8_t * const newdata = buffer + newpos; - int len = std::min( len0, len1 ); while( len < len_limit && newdata[len] == data[len] ) ++len; const int delta = pos - newpos; @@ -179,14 +177,14 @@ int Matchfinder::longest_match_len( int * const distances ) throw() prev_pos_tree[idx0] = newpos; idx0 = newidx + 1; newpos = prev_pos_tree[idx0]; - len0 = len; + len0 = len; if( len1 < len ) len = len1; } else { prev_pos_tree[idx1] = newpos; idx1 = newidx; newpos = prev_pos_tree[idx1]; - len1 = len; + len1 = len; if( len0 < len ) len = len0; } } else @@ -308,6 +306,7 @@ int LZ_encoder::best_pair_sequence( const int reps[num_rep_distances], trials[0].state = state; for( int i = 0; i < num_rep_distances; ++i ) trials[0].reps[i] = reps[i]; + const uint8_t prev_byte = matchfinder[-1]; const uint8_t cur_byte = matchfinder[0]; const uint8_t match_byte = matchfinder[-reps[0]-1]; unsigned int position = matchfinder.data_position(); @@ -317,9 +316,9 @@ int LZ_encoder::best_pair_sequence( const int reps[num_rep_distances], trials[1].prev_index = 0; trials[1].price = price0( bm_match[state()][pos_state] ); if( state.is_char() ) - trials[1].price += literal_encoder.price_symbol( matchfinder[-1], cur_byte ); + trials[1].price += literal_encoder.price_symbol( prev_byte, cur_byte ); else - trials[1].price += literal_encoder.price_matched( matchfinder[-1], cur_byte, match_byte ); + trials[1].price += literal_encoder.price_matched( prev_byte, cur_byte, match_byte ); const int match_price = price1( bm_match[state()][pos_state] ); const int rep_match_price = match_price + price1( bm_rep[state()] ); @@ -353,9 +352,13 @@ int LZ_encoder::best_pair_sequence( const int reps[num_rep_distances], } for( int rep = 0; rep < num_rep_distances; ++rep ) + { + const int price = rep_match_price + + price_rep( rep, state, pos_state ); for( int len = min_match_len; len <= replens[rep]; ++len ) - trials[len].update( rep, 0, rep_match_price + - price_rep( rep, len, state, pos_state ) ); + trials[len].update( rep, 0, price + + rep_match_len_encoder.price( len, pos_state ) ); + } int cur = 0; int num_trials = main_len; @@ -395,14 +398,15 @@ int LZ_encoder::best_pair_sequence( const int reps[num_rep_distances], mtf_reps( cur_trial.dis, cur_trial.reps ); } + const uint8_t prev_byte = matchfinder[-1]; const uint8_t cur_byte = matchfinder[0]; const uint8_t match_byte = matchfinder[-cur_trial.reps[0]-1]; const int pos_state = ++position & pos_state_mask; int next_price = cur_trial.price + price0( bm_match[cur_trial.state()][pos_state] ); if( cur_trial.state.is_char() ) - next_price += literal_encoder.price_symbol( matchfinder[-1], cur_byte ); + next_price += literal_encoder.price_symbol( prev_byte, cur_byte ); else - next_price += literal_encoder.price_matched( matchfinder[-1], cur_byte, match_byte ); + next_price += literal_encoder.price_matched( prev_byte, cur_byte, match_byte ); if( !matchfinder.move_pos() ) return 0; Trial & next_trial = trials[cur+1]; @@ -428,11 +432,13 @@ int LZ_encoder::best_pair_sequence( const int reps[num_rep_distances], while( len < len_limit && data[len] == data[len-dis] ) ++len; if( len >= min_match_len ) { + const int price = rep_match_price + + price_rep( rep, cur_trial.state, pos_state ); while( num_trials < cur + len ) trials[++num_trials].price = infinite_price; for( ; len >= min_match_len; --len ) - trials[cur+len].update( rep, cur, rep_match_price + - price_rep( rep, len, cur_trial.state, pos_state ) ); + trials[cur+len].update( rep, cur, price + + rep_match_len_encoder.price( len, pos_state ) ); } } @@ -446,7 +452,7 @@ int LZ_encoder::best_pair_sequence( const int reps[num_rep_distances], while( num_trials < cur + newlen ) trials[++num_trials].price = infinite_price; - for( int len = newlen; len >= min_match_len; --len ) + for( int len = min_match_len; len <= newlen; ++len ) trials[cur+len].update( match_distances[len] + num_rep_distances, cur, normal_match_price + price_pair( match_distances[len], len, pos_state ) ); @@ -496,19 +502,18 @@ bool LZ_encoder::encode_member( const long long member_size ) { if( range_encoder.member_position() != sizeof( File_header ) ) return false; // can be called only once - const long long member_size_limit = member_size - sizeof( File_trailer ) - 15; + const long long member_size_limit = member_size - sizeof( File_trailer ) - 16; int fill_counter = 0; int rep_distances[num_rep_distances]; State state; - uint8_t prev_byte = 0; for( int i = 0; i < num_rep_distances; ++i ) rep_distances[i] = 0; - if( !matchfinder.finished() ) // copy first byte + if( !matchfinder.finished() ) // encode first byte { range_encoder.encode_bit( bm_match[state()][0], 0 ); + const uint8_t prev_byte = 0; const uint8_t cur_byte = matchfinder[0]; literal_encoder.encode( range_encoder, prev_byte, cur_byte ); - prev_byte = cur_byte; crc32.update( crc_, cur_byte ); if( !move_pos( 1 ) ) return false; } @@ -532,16 +537,16 @@ bool LZ_encoder::encode_member( const long long member_size ) range_encoder.encode_bit( bm_match[state()][pos_state], !bit ); if( bit ) { + const uint8_t prev_byte = matchfinder[-ahead-1]; const uint8_t cur_byte = matchfinder[-ahead]; if( state.is_char() ) literal_encoder.encode( range_encoder, prev_byte, cur_byte ); else { - const uint8_t match_byte = matchfinder[-rep_distances[0]-1-ahead]; + const uint8_t match_byte = matchfinder[-ahead-rep_distances[0]-1]; literal_encoder.encode_matched( range_encoder, prev_byte, match_byte, cur_byte ); } state.set_char(); - prev_byte = cur_byte; } else { @@ -572,7 +577,6 @@ bool LZ_encoder::encode_member( const long long member_size ) encode_pair( dis - num_rep_distances, len, pos_state ); state.set_match(); } - prev_byte = matchfinder[len-1-ahead]; } for( int j = 0; j < len; ++j ) crc32.update( crc_, matchfinder[j-ahead] ); @@ -135,7 +135,11 @@ inline int price_matched( const Bit_model bm[], const int symbol, class Matchfinder { - enum { num_prev_positions4 = 1 << 20, + enum { // bytes to keep in buffer before dictionary + before_size = max_num_trials + 1, + // bytes to keep in buffer after pos + after_size = max_match_len, + num_prev_positions4 = 1 << 20, num_prev_positions3 = 1 << 18, num_prev_positions2 = 1 << 16, num_prev_positions = num_prev_positions4 + num_prev_positions3 + @@ -143,7 +147,6 @@ class Matchfinder long long partial_data_pos; int dictionary_size_; // bytes to keep in buffer before pos - const int after_size; // bytes to keep in buffer after pos int buffer_size; uint8_t * buffer; int pos; @@ -413,7 +416,7 @@ class LZ_encoder { State state; int dis; - int prev_index; + int prev_index; // index of prev trial in trials[] int price; // dual use var; cumulative price, match length int reps[num_rep_distances]; void update( const int d, const int p_i, const int pr ) throw() @@ -473,25 +476,18 @@ class LZ_encoder return price0( bm_rep0[state()] ) + price0( bm_len[state()][pos_state] ); } - int price_rep( const int rep, const int len, const State & state, + int price_rep( const int rep, const State & state, const int pos_state ) const throw() { - int price = rep_match_len_encoder.price( len, pos_state ); - if( rep == 0 ) - { - price += price0( bm_rep0[state()] ); - price += price1( bm_len[state()][pos_state] ); - } + if( rep == 0 ) return price0( bm_rep0[state()] ) + + price1( bm_len[state()][pos_state] ); + int price = price1( bm_rep0[state()] ); + if( rep == 1 ) + price += price0( bm_rep1[state()] ); else { - price += price1( bm_rep0[state()] ); - if( rep == 1 ) - price += price0( bm_rep1[state()] ); - else - { - price += price1( bm_rep1[state()] ); - price += price_bit( bm_rep2[state()], rep - 2 ); - } + price += price1( bm_rep1[state()] ); + price += price_bit( bm_rep2[state()], rep - 2 ); } return price; } @@ -1,152 +0,0 @@ -#! /bin/sh -# Lzdiff - Diff/cmp wrapper for compressed files. -# Copyright (C) 2008, 2009 Antonio Diaz Diaz. -# -# This script is free software: you have unlimited permission -# to copy, distribute and modify it. - -LC_ALL=C -export LC_ALL -invocation_name=$0 -args= -default_ext=.lz -diff_prog=diff -file1= -file2= - -# Loop over args -while [ x"$1" != x ] ; do - - case "$1" in - --help | --he* | -h) - echo "Lzdiff - Diff/cmp wrapper for compressed files." - echo - echo "Lzdiff is a wrapper script around the diff and cmp commands that allows" - echo "transparent comparison of any combination of compressed and" - echo "non-compressed files. If any given file is compressed, its uncompressed" - echo "content is used. The supported compressors are gzip, bzip2 and lzip." - echo - echo "Usage: ${invocation_name} [OPTIONS] [DIFF_OPTIONS] FILE1 [FILE2]" - echo - echo "Compares FILE1 to FILE2. If FILE2 is omitted, compares FILE1 to the" - echo "uncompressed contents of FILE1.[gz|bz2|lz] (depending on the default" - echo "compressor selected). DIFF_OPTIONS are passed directly to diff or cmp." - echo "The exit status from diff or cmp is preserved." - echo - echo "Options:" - echo " -h, --help display this help and exit" - echo " -V, --version output version information and exit" - echo " --gzip use gzip as default decompressor" - echo " --bzip2 use bzip2 as default decompressor" - echo " --lzip use lzip as default decompressor (default)" - echo " --diff use diff to compare files (default)" - echo " --cmp use cmp to compare files" - echo - echo "Report bugs to lzip-bug@nongnu.org" - echo "Lzip home page: http://www.nongnu.org/lzip/lzip.html" - exit 0 ;; - --version | --ve* | -V) - echo "Lzdiff 0.5" - echo "Copyright (C) 2009 Antonio Diaz Diaz." - echo "This script is free software: you have unlimited permission" - echo "to copy, distribute and modify it." - exit 0 ;; - --gz*) - default_ext=.gz ;; - --bz*) - default_ext=.bz2 ;; - --lz*) - default_ext=.lz ;; - --diff) - diff_prog=diff ;; - --cmp) - diff_prog=cmp ;; - -) - echo "${invocation_name}: reading from stdin not supported" - exit 1 ;; - --) - ;; - -?*) - args="${args} $1" ;; - *) - if test -f "$1"; then - if test -z "${file1}"; then file1="$1" - else - if test -z "${file2}"; then file2="$1" - else - echo "${invocation_name}: Too many files; use --help for usage." 1>&2 - fi - fi - else - echo "${invocation_name}: File \"$1\" not found or not a regular file" 1>&2 - exit 1 - fi ;; - esac - shift -done - -if test -z "${file1}"; then - echo "${invocation_name}: No files given; use --help for usage." 1>&2 - exit 1 -fi - -if test -z "${file2}"; then - case "${file1}" in - *.gz) - file2=`printf "%s" "${file1}" | sed 's/.gz$//'` ;; - *.tgz) - file2=`printf "%s" "${file1}" | sed 's/tgz$/tar/'` ;; - *.bz2) - file2=`printf "%s" "${file1}" | sed 's/.bz2$//'` ;; - *.tbz) - file2=`printf "%s" "${file1}" | sed 's/tbz$/tar/'` ;; - *.tbz2) - file2=`printf "%s" "${file1}" | sed 's/tbz2$/tar/'` ;; - *.lz) - file2=`printf "%s" "${file1}" | sed 's/.lz$//'` ;; - *.tlz) - file2=`printf "%s" "${file1}" | sed 's/tlz$/tar/'` ;; - *) - file2="${file1}${default_ext}" ;; - esac -fi - -prog1= -prog2= -case "${file1}" in -*.gz | *.tgz) prog1=gzip ;; -*.bz2 | *.tbz | *.tbz2) prog1=bzip2 ;; -*.lz | *.tlz) prog1=lzip ;; -esac -case "${file2}" in -*.gz | *.tgz) prog2=gzip ;; -*.bz2 | *.tbz | *.tbz2) prog2=bzip2 ;; -*.lz | *.tlz) prog2=lzip ;; -esac - -retval=0 -if test -n "${prog1}"; then - if test -n "${prog2}"; then - tmp_file=`mktemp "${TMPDIR:-/tmp}"/lzdiff.XXXXXXXXXX` || { - echo 'cannot create a temporary file' 1>&2 - exit 1 - } - ${prog2} -cdfq "${file2}" > "${tmp_file}" || exit 1 - ${prog1} -cdfq "${file1}" | ${diff_prog} ${args} - "${tmp_file}" - retval=$? - rm -f "${tmp_file}" || retval=$? - else - ${prog1} -cdfq "${file1}" | ${diff_prog} ${args} - "${file2}" - retval=$? - fi -else - if test -n "${prog2}"; then - ${prog2} -cdfq "${file2}" | ${diff_prog} ${args} "${file1}" - - retval=$? - else - ${diff_prog} ${args} "${file1}" "${file2}" - retval=$? - fi -fi - -exit ${retval} @@ -1,135 +0,0 @@ -#! /bin/sh -# Lzgrep - Grep wrapper for compressed files. -# Copyright (C) 2008, 2009 Antonio Diaz Diaz. -# -# This script is free software: you have unlimited permission -# to copy, distribute and modify it. - -LC_ALL=C -export LC_ALL -invocation_name=$0 -args= -default_prog=lzip -have_pat=0 -list=0 -no_name=0 - -# Loop over args until pattern is found -while [ x"$1" != x ] ; do - - case "$1" in - --help | --he* | -h) - echo "Lzgrep - Grep wrapper for compressed files." - echo - echo "Lzgrep is a wrapper script around the grep command that allows" - echo "transparent search on any combination of compressed and non-compressed" - echo "files. If any given file is compressed, its uncompressed content is" - echo "used. If a given file does not exist, lzgrep tries the compressed file" - echo "name corresponding to the default compressor selected. The supported" - echo "compressors are gzip, bzip2 and lzip." - echo - echo "Usage: ${invocation_name} [OPTIONS] [GREP_OPTIONS] PATTERN [FILES]" - echo - echo "GREP_OPTIONS are passed directly to grep." - echo "The exit status from grep is preserved." - echo - echo "Options:" - echo " -h, --help display this help and exit" - echo " -V, --version output version information and exit" - echo " --gzip use gzip as default decompressor" - echo " --bzip2 use bzip2 as default decompressor" - echo " --lzip use lzip as default decompressor (default)" - echo - echo "Report bugs to lzip-bug@nongnu.org" - echo "Lzip home page: http://www.nongnu.org/lzip/lzip.html" - exit 0 ;; - --version | --ve* | -V) - echo "Lzgrep 0.5" - echo "Copyright (C) 2009 Antonio Diaz Diaz." - echo "This script is free software: you have unlimited permission" - echo "to copy, distribute and modify it." - exit 0 ;; - --gz*) - default_prog=gzip ;; - --bz*) - default_prog=bzip2 ;; - --lz*) - default_prog=lzip ;; - -[drRzZ] | --di* | --exc* | --inc* | --nu* | --rec*) - echo "${invocation_name}: option $1 not supported" - exit 1 ;; - -e?* | -f?* | --file=* | --reg*=*) - args="${args} $1"; have_pat=1 ;; - -e | -f | --file | --reg*) - args="${args} $1 $2"; shift; have_pat=1 ;; - --*=*) - args="${args} $1" ;; - -[ABCDm] | --af* | --be* | --binary-* | --con* | --de* | --[lm]a*) - args="${args} $1 $2"; shift ;; - -l | --files-with-*) - args="${args} $1"; list=1 ;; - -h | --no-f*) - args="${args} $1"; no_name=1 ;; - --) - break ;; - -?*) - args="${args} $1" ;; - *) - if test ${have_pat} = 0; then args="${args} $1"; have_pat=1 - else break - fi ;; - esac - shift -done - -if test ${have_pat} = 0; then - echo "${invocation_name}: Pattern not found; use --help for usage." 1>&2 - exit 1 -fi - -if test $# -eq 0; then - ${default_prog} -cdfq | grep ${args} - exit $? -fi - -retval=0 -for i in "$@" ; do - prog="${default_prog} -cdfq" - case "$i" in - *.gz | *.tgz) - prog="gzip -cdfq" ;; - *.bz2 | *.tbz | *.tbz2) - prog="bzip2 -cdfq" ;; - *.lz | *.tlz) - prog="lzip -cdfq" ;; - *) - if test -f "$i"; then prog=cat - else - case ${default_prog} in - gzip) - if test -f "$i.gz"; then i="$i.gz"; fi ;; - bzip2) - if test -f "$i.bz2"; then i="$i.bz2"; fi ;; - lzip) - if test -f "$i.lz"; then i="$i.lz"; fi ;; - esac - fi ;; - esac - if test ${list} -eq 1; then - ${prog} -- "$i" | grep ${args} 2>&1 > /dev/null && echo "$i" - r=$? - elif test $# -eq 1 -o ${no_name} -eq 1; then - ${prog} -- "$i" | grep ${args} - r=$? - else - j=`printf "%s" "$i" | sed 's/\\\\/\\\\\\\\/g'` - j=`printf "%s" "$j" | sed 's/|/\\\\|/g'` - j=`printf "%s" "$j" | sed 's/&/\\\\&/g'` - j=`printf "%s" "$j" | tr '\n' ' '` - ${prog} -- "$i" | grep ${args} | sed "s|^|${j}:|" - r=$? - fi - test "$r" -ne 0 && retval="$r" -done - -exit ${retval} @@ -26,6 +26,7 @@ #include <algorithm> #include <cerrno> #include <climits> +#include <csignal> #include <cstdio> #include <cstdlib> #include <cstring> @@ -33,7 +34,6 @@ #include <vector> #include <fcntl.h> #include <stdint.h> -#include <signal.h> #include <unistd.h> #include <utime.h> #include <sys/stat.h> @@ -413,7 +413,7 @@ int compress( const long long member_size, const long long volume_size, header.dictionary_size( matchfinder.dictionary_size() ); long long in_size = 0, out_size = 0, partial_volume_size = 0; - while( true ) + while( true ) // encode one member per iteration { LZ_encoder encoder( matchfinder, header, outhandle ); const long long size = @@ -469,19 +469,19 @@ int decompress( const int inhandle, const Pretty_print & pp, try { Input_buffer ibuf( inhandle ); long long partial_file_pos = 0; - for( bool first_pass = true; ; first_pass = false, pp.reset() ) + for( bool first_member = true; ; first_member = false, pp.reset() ) { File_header header; for( unsigned int i = 0; i < sizeof header; ++i ) ((uint8_t *)&header)[i] = ibuf.get_byte(); - if( ibuf.finished() ) + if( ibuf.finished() ) // End Of File { - if( first_pass ) { pp( "error reading member header" ); return 1; } - else break; + if( !first_member ) break; + pp( "error reading member header" ); return 1; } if( !header.verify_magic() ) { - if( !first_pass ) break; + if( !first_member ) break; // trailing garbage if( verbosity >= 0 ) { pp(); std::fprintf( stderr, "bad magic number (file not created by %s).\n", diff --git a/testsuite/check.sh b/testsuite/check.sh index f871f28..3ac3604 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -29,7 +29,7 @@ fail=0 "${LZIP}" -cd "${testdir}"/COPYING.lz > copy || fail=1 cmp in copy || fail=1 -for i in 1 2 3 4 5 6 7 8 9; do +for i in s4096 1 2 3 4 5 6 7 8 9; do "${LZIP}" -k -$i in || fail=1 mv -f in.lz copy.lz || fail=1 echo -n "garbage" >> copy.lz || fail=1 @@ -38,7 +38,7 @@ for i in 1 2 3 4 5 6 7 8 9; do echo -n . done -for i in 1 2 3 4 5 6 7 8 9; do +for i in s4096 1 2 3 4 5 6 7 8 9; do "${LZIP}" -c -$i in > out || fail=1 echo -n "g" >> out || fail=1 "${LZIP}" -cd out > copy || fail=1 @@ -46,14 +46,14 @@ for i in 1 2 3 4 5 6 7 8 9; do echo -n . done -for i in 1 2 3 4 5 6 7 8 9; do +for i in s4096 1 2 3 4 5 6 7 8 9; do "${LZIP}" -c -$i < in > out || fail=1 "${LZIP}" -d < out > copy || fail=1 cmp in copy || fail=1 echo -n . done -for i in 1 2 3 4 5 6 7 8 9; do +for i in s4096 1 2 3 4 5 6 7 8 9; do "${LZIP}" -f -$i -o out < in || fail=1 "${LZIP}" -df -o copy < out.lz || fail=1 cmp in copy || fail=1 @@ -70,9 +70,9 @@ for i in 1 2 3; do done echo -if test ${fail} = 0; then +if [ ${fail} = 0 ]; then echo "tests completed successfully." - if cd "${objdir}" ; then rm -r tmp ; fi + cd "${objdir}" && rm -r tmp else echo "tests failed." fi diff --git a/testsuite/unzcrash.cc b/testsuite/unzcrash.cc index bf44628..4856a73 100644 --- a/testsuite/unzcrash.cc +++ b/testsuite/unzcrash.cc @@ -19,10 +19,10 @@ g++ -O2 -Wall -W -o unzcrash testsuite/unzcrash.cc */ +#include <csignal> #include <cstdio> #include <cstdlib> #include <stdint.h> -#include <signal.h> #include <unistd.h> |