diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 05:08:34 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 05:08:34 +0000 |
commit | 439ba23e0b2108539d1ae0fcfb227a8d1017bb6e (patch) | |
tree | b334c2cc7f36958ad43ab993455f12ba88ae3ad8 | |
parent | Adding upstream version 1.6. (diff) | |
download | lunzip-439ba23e0b2108539d1ae0fcfb227a8d1017bb6e.tar.xz lunzip-439ba23e0b2108539d1ae0fcfb227a8d1017bb6e.zip |
Adding upstream version 1.7~pre1.upstream/1.7_pre1
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | INSTALL | 13 | ||||
-rw-r--r-- | Makefile.in | 30 | ||||
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | README | 32 | ||||
-rw-r--r-- | carg_parser.c | 3 | ||||
-rw-r--r-- | carg_parser.h | 3 | ||||
-rwxr-xr-x | configure | 6 | ||||
-rw-r--r-- | decoder.c | 10 | ||||
-rw-r--r-- | decoder.h | 11 | ||||
-rw-r--r-- | doc/lunzip.1 | 8 | ||||
-rw-r--r-- | lzip.h | 2 | ||||
-rw-r--r-- | main.c | 51 | ||||
-rwxr-xr-x | testsuite/check.sh | 2 |
14 files changed, 116 insertions, 70 deletions
@@ -1,3 +1,9 @@ +2015-03-26 Antonio Diaz Diaz <antonio@gnu.org> + + * Version 1.7-pre1 released. + * Minor changes. + * Makefile.in: Added new targets 'install*-compress'. + 2014-07-01 Antonio Diaz Diaz <antonio@gnu.org> * Version 1.6 released. @@ -48,7 +54,7 @@ * Created from the decompression code of clzip 1.1. -Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. +Copyright (C) 2010-2015 Antonio Diaz Diaz. This file is a collection of facts, and thus it is not copyrightable, but just in case, you have unlimited permission to copy, distribute and @@ -1,7 +1,7 @@ Requirements ------------ You will need a C compiler. -I use gcc 4.8.1 and 3.3.6, but the code should compile with any +I use gcc 4.9.1 and 3.3.6, but the code should compile with any standards compliant compiler. Gcc is available at http://gcc.gnu.org. @@ -32,9 +32,12 @@ the main archive. 5. Type 'make install' to install the program and any data files and documentation. - You can install only the program, the info manual or the man page - typing 'make install-bin', 'make install-info' or 'make install-man' - respectively. + Or type 'make install-compress', which additionally compresses the + man page after installation. (Installing compressed docs may become + the default in the future). + + You can install only the program or the man page by typing 'make + install-bin' or 'make install-man' respectively. Instead of 'make install', you can type 'make install-as-lzip' to install the program and any data files and documentation, and link @@ -58,7 +61,7 @@ After running 'configure', you can run 'make' and 'make install' as explained above. -Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. +Copyright (C) 2010-2015 Antonio Diaz Diaz. This file is free documentation: you have unlimited permission to copy, distribute and modify it. diff --git a/Makefile.in b/Makefile.in index bafcab3..a94ec86 100644 --- a/Makefile.in +++ b/Makefile.in @@ -9,7 +9,9 @@ SHELL = /bin/sh objs = carg_parser.o decoder.o main.o -.PHONY : all install install-bin install-info install-man install-strip \ +.PHONY : all install install-bin install-info install-man \ + install-strip install-compress install-strip-compress \ + install-bin-strip install-info-compress install-man-compress \ install-as-lzip uninstall uninstall-bin uninstall-info uninstall-man \ doc info man check dist clean distclean @@ -18,9 +20,6 @@ all : $(progname) $(progname) : $(objs) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(objs) -$(progname)_profiled : $(objs) - $(CC) $(CFLAGS) $(LDFLAGS) -pg -o $@ $(objs) - main.o : main.c $(CC) $(CFLAGS) $(CPPFLAGS) -DPROGVERSION=\"$(pkgversion)\" -c -o $@ $< @@ -52,38 +51,49 @@ check : all @$(VPATH)/testsuite/check.sh $(VPATH)/testsuite $(pkgversion) install : install-bin install-man +install-strip : install-bin-strip install-man +install-compress : install-bin install-man-compress +install-strip-compress : install-bin-strip install-man-compress install-bin : all if [ ! -d "$(DESTDIR)$(bindir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(bindir)" ; fi $(INSTALL_PROGRAM) ./$(progname) "$(DESTDIR)$(bindir)/$(progname)" +install-bin-strip : all + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install-bin + install-info : if [ ! -d "$(DESTDIR)$(infodir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(infodir)" ; fi + -rm -f "$(DESTDIR)$(infodir)/$(pkgname).info"* $(INSTALL_DATA) $(VPATH)/doc/$(pkgname).info "$(DESTDIR)$(infodir)/$(pkgname).info" -install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$(pkgname).info" +install-info-compress : install-info + lzip -v -9 "$(DESTDIR)$(infodir)/$(pkgname).info" + install-man : if [ ! -d "$(DESTDIR)$(mandir)/man1" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" ; fi + -rm -f "$(DESTDIR)$(mandir)/man1/$(progname).1"* $(INSTALL_DATA) $(VPATH)/doc/$(progname).1 "$(DESTDIR)$(mandir)/man1/$(progname).1" -install-strip : all - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install +install-man-compress : install-man + lzip -v -9 "$(DESTDIR)$(mandir)/man1/$(progname).1" install-as-lzip : install -rm -f "$(DESTDIR)$(bindir)/lzip" cd "$(DESTDIR)$(bindir)" && ln -s $(progname) lzip -uninstall : uninstall-bin uninstall-man +uninstall : uninstall-man uninstall-bin uninstall-bin : -rm -f "$(DESTDIR)$(bindir)/$(progname)" uninstall-info : -install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$(pkgname).info" - -rm -f "$(DESTDIR)$(infodir)/$(pkgname).info" + -rm -f "$(DESTDIR)$(infodir)/$(pkgname).info"* uninstall-man : - -rm -f "$(DESTDIR)$(mandir)/man1/$(progname).1" + -rm -f "$(DESTDIR)$(mandir)/man1/$(progname).1"* dist : doc ln -sf $(VPATH) $(DISTNAME) @@ -106,7 +116,7 @@ dist : doc lzip -v -9 $(DISTNAME).tar clean : - -rm -f $(progname) $(progname)_profiled $(objs) + -rm -f $(progname) $(objs) distclean : clean -rm -f Makefile config.status *.tar *.tar.lz @@ -1,3 +1,6 @@ -Changes in version 1.6: +Changes in version 1.7: -The license has been changed to GPL version 2 or later. +Minor changes have been made. + +The targets "install-compress", "install-strip-compress", and +"install-man-compress" have been added to the Makefile. @@ -5,9 +5,30 @@ small size makes it well suited for embedded devices or software installers that need to decompress files but do not need compression capabilities. Lunzip is fully compatible with lzip-1.4 or newer. -The lzip file format is designed for long-term data archiving. It is -clean, provides very safe 4 factor integrity checking, and is backed by -the recovery capabilities of lziprecover. +The lzip file format is designed for data sharing and long-term +archiving, taking into account both data integrity and decoder +availability: + + * The lzip format provides very safe integrity checking and some data + recovery means. The lziprecover program can repair bit-flip errors + (one of the most common forms of data corruption) in lzip files, + and provides data recovery capabilities, including error-checked + merging of damaged copies of a file. + + * The lzip format is as simple as possible (but not simpler). The + lzip manual provides the code of a simple decompressor along with a + detailed explanation of how it works, so that with the only help of + the lzip manual it would be possible for a digital archaeologist to + extract the data from a lzip file long after quantum computers + eventually render LZMA obsolete. + + * Additionally the lzip reference implementation is copylefted, which + guarantees that it will remain free forever. + +A nice feature of the lzip format is that a corrupt byte is easier to +repair the nearer it is from the beginning of the file. Therefore, with +the help of lziprecover, losing an entire archive just because of a +corrupt byte near the beginning is a thing of the past. Lunzip uses the same well-defined exit status values used by lzip and bzip2, which makes it safer than decompressors returning ambiguous @@ -23,7 +44,8 @@ smaller the output buffer size used in relation to the dictionary size, the more accesses to disk are needed and the slower the decompression is. This "low memory" mode only works when decompressing to a regular file and is intended for systems without enough memory (RAM + swap) to -keep the whole dictionary at once. +keep the whole dictionary at once. It has been tested on a laptop with a +486 processor and 4MiB of RAM. The amount of memory required by lunzip to decompress a file is about 46 kB larger than the dictionary size used to compress that file, unless @@ -61,7 +83,7 @@ range encoding), Igor Pavlov (for putting all the above together in LZMA), and Julian Seward (for bzip2's CLI). -Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. +Copyright (C) 2010-2015 Antonio Diaz Diaz. This file is free documentation: you have unlimited permission to copy, distribute and modify it. diff --git a/carg_parser.c b/carg_parser.c index c4f88a3..a453e36 100644 --- a/carg_parser.c +++ b/carg_parser.c @@ -1,6 +1,5 @@ /* Arg_parser - POSIX/GNU command line argument parser. (C version) - Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 - Antonio Diaz Diaz. + Copyright (C) 2006-2015 Antonio Diaz Diaz. This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/carg_parser.h b/carg_parser.h index 4215828..34b1263 100644 --- a/carg_parser.h +++ b/carg_parser.h @@ -1,6 +1,5 @@ /* Arg_parser - POSIX/GNU command line argument parser. (C version) - Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 - Antonio Diaz Diaz. + Copyright (C) 2006-2015 Antonio Diaz Diaz. This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1,12 +1,12 @@ #! /bin/sh # configure script for Lunzip - Decompressor for lzip files -# Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. +# Copyright (C) 2010-2015 Antonio Diaz Diaz. # # This configure script is free software: you have unlimited permission # to copy, distribute and modify it. pkgname=lunzip -pkgversion=1.6 +pkgversion=1.7-pre1 progname=lunzip srctrigger=doc/${progname}.1 @@ -165,7 +165,7 @@ echo "LDFLAGS = ${LDFLAGS}" rm -f Makefile cat > Makefile << EOF # Makefile for Lunzip - Decompressor for lzip files -# Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. +# Copyright (C) 2010-2015 Antonio Diaz Diaz. # This file was generated automatically by configure. Do not edit. # # This Makefile is free software: you have unlimited permission @@ -1,5 +1,5 @@ /* Lunzip - Decompressor for lzip files - Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. + Copyright (C) 2010-2015 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -222,7 +222,7 @@ int LZd_decode_member( struct LZ_decoder * const d, const int pos_state = LZd_data_position( d ) & pos_state_mask; if( Rd_decode_bit( rdec, &d->bm_match[state][pos_state] ) == 0 ) /* 1st bit */ { - const uint8_t prev_byte = LZd_get_prev_byte( d ); + const uint8_t prev_byte = LZd_peek1( d ); if( St_is_char( state ) ) { state -= ( state < 4 ) ? state : 3; @@ -234,7 +234,7 @@ int LZd_decode_member( struct LZ_decoder * const d, state -= ( state < 10 ) ? 3 : 6; LZd_put_byte( d, Rd_decode_matched( rdec, d->bm_literal[get_lit_state(prev_byte)], - LZd_get_byte( d, rep0 ) ) ); + LZd_peek( d, rep0 ) ) ); } } else @@ -262,7 +262,7 @@ int LZd_decode_member( struct LZ_decoder * const d, { if( Rd_decode_bit( rdec, &d->bm_len[state][pos_state] ) == 0 ) /* 4th bit */ { state = St_set_short_rep( state ); - LZd_put_byte( d, LZd_get_byte( d, rep0 ) ); continue; } + LZd_put_byte( d, LZd_peek( d, rep0 ) ); continue; } } state = St_set_rep( state ); len = min_match_len + Rd_decode_len( rdec, &d->rep_len_model, pos_state ); @@ -285,7 +285,7 @@ int LZd_decode_member( struct LZ_decoder * const d, { rep0 += Rd_decode( rdec, direct_bits - dis_align_bits ) << dis_align_bits; rep0 += Rd_decode_tree_reversed4( rdec, d->bm_align ); - if( rep0 == 0xFFFFFFFFU ) /* Marker found */ + if( rep0 == 0xFFFFFFFFU ) /* marker found */ { rep0 = rep0_saved; Rd_normalize( rdec ); @@ -1,5 +1,5 @@ /* Lunzip - Decompressor for lzip files - Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. + Copyright (C) 2010-2015 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -259,14 +259,14 @@ void LZd_flush_data( struct LZ_decoder * const d ); int seek_read( const int fd, uint8_t * const buf, const int size, const int offset ); -static inline uint8_t LZd_get_prev_byte( const struct LZ_decoder * const d ) +static inline uint8_t LZd_peek1( const struct LZ_decoder * const d ) { const int i = ( ( d->pos > 0 ) ? d->pos : d->buffer_size ) - 1; return d->buffer[i]; } -static inline uint8_t LZd_get_byte( const struct LZ_decoder * const d, - const int distance ) +static inline uint8_t LZd_peek( const struct LZ_decoder * const d, + const int distance ) { uint8_t b; const int i = d->pos - distance - 1; @@ -319,7 +319,7 @@ static inline void LZd_copy_block2( struct LZ_decoder * const d, } } for( ; len > 0; --len ) - LZd_put_byte( d, LZd_get_byte( d, distance ) ); + LZd_put_byte( d, LZd_peek( d, distance ) ); } static inline bool LZd_init( struct LZ_decoder * const d, @@ -348,7 +348,6 @@ static inline bool LZd_init( struct LZ_decoder * const d, Bm_array_init( d->bm_dis_slot[0], len_states * (1 << dis_slot_bits) ); Bm_array_init( d->bm_dis, modeled_distances - end_dis_model ); Bm_array_init( d->bm_align, dis_align_size ); - Lm_init( &d->match_len_model ); Lm_init( &d->rep_len_model ); d->buffer[d->buffer_size-1] = 0; /* prev_byte of first byte */ diff --git a/doc/lunzip.1 b/doc/lunzip.1 index 5a7c1ee..4178c92 100644 --- a/doc/lunzip.1 +++ b/doc/lunzip.1 @@ -1,10 +1,10 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. -.TH LUNZIP "1" "July 2014" "lunzip 1.6" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. +.TH LUNZIP "1" "March 2015" "lunzip 1.7-pre1" "User Commands" .SH NAME lunzip \- decompressor for lzip files .SH SYNOPSIS .B lunzip -[\fIoptions\fR] [\fIfiles\fR] +[\fI\,options\/\fR] [\fI\,files\/\fR] .SH DESCRIPTION Lunzip is a decompressor for lzip files. It is written in C and its small size makes it well suited for embedded devices or software @@ -68,7 +68,7 @@ Report bugs to lzip\-bug@nongnu.org .br Lunzip home page: http://www.nongnu.org/lzip/lunzip.html .SH COPYRIGHT -Copyright \(co 2014 Antonio Diaz Diaz. +Copyright \(co 2015 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> .br This is free software: you are free to change and redistribute it. @@ -1,5 +1,5 @@ /* Lunzip - Decompressor for lzip files - Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. + Copyright (C) 2010-2015 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1,5 +1,5 @@ /* Lunzip - Decompressor for lzip files - Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. + Copyright (C) 2010-2015 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ const char * const Program_name = "Lunzip"; const char * const program_name = "lunzip"; -const char * const program_year = "2014"; +const char * const program_year = "2015"; const char * invocation_name = 0; struct { const char * from; const char * to; } const known_extensions[] = { @@ -134,18 +134,21 @@ static void show_version( void ) static void show_header( const unsigned dictionary_size ) { - const char * const prefix[8] = - { "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi" }; - enum { factor = 1024 }; - const char * p = ""; - const char * np = " "; - unsigned num = dictionary_size, i; - bool exact = ( num % factor == 0 ); - - for( i = 0; i < 8 && ( num > 9999 || ( exact && num >= factor ) ); ++i ) - { num /= factor; if( num % factor != 0 ) exact = false; - p = prefix[i]; np = ""; } - fprintf( stderr, "dictionary size %s%4u %sB. ", np, num, p ); + if( verbosity >= 3 ) + { + const char * const prefix[8] = + { "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi" }; + enum { factor = 1024 }; + const char * p = ""; + const char * np = " "; + unsigned num = dictionary_size, i; + bool exact = ( num % factor == 0 ); + + for( i = 0; i < 8 && ( num > 9999 || ( exact && num >= factor ) ); ++i ) + { num /= factor; if( num % factor != 0 ) exact = false; + p = prefix[i]; np = ""; } + fprintf( stderr, "dictionary size %s%4u %sB. ", np, num, p ); + } } @@ -222,8 +225,10 @@ static int extension_index( const char * const name ) for( i = 0; known_extensions[i].from; ++i ) { const char * const ext = known_extensions[i].from; - if( strlen( name ) > strlen( ext ) && - strncmp( name + strlen( name ) - strlen( ext ), ext, strlen( ext ) ) == 0 ) + const unsigned name_len = strlen( name ); + const unsigned ext_len = strlen( ext ); + if( name_len > ext_len && + strncmp( name + name_len - ext_len, ext, ext_len ) == 0 ) return i; } return -1; @@ -278,20 +283,21 @@ static void * resize_buffer( void * buf, const int min_size ) static void set_d_outname( const char * const name, const int i ) { + const unsigned name_len = strlen( name ); if( i >= 0 ) { const char * const from = known_extensions[i].from; - if( strlen( name ) > strlen( from ) ) + const unsigned from_len = strlen( from ); + if( name_len > from_len ) { - output_filename = resize_buffer( output_filename, strlen( name ) + + output_filename = resize_buffer( output_filename, name_len + strlen( known_extensions[0].to ) + 1 ); strcpy( output_filename, name ); - strcpy( output_filename + strlen( name ) - strlen( from ), - known_extensions[i].to ); + strcpy( output_filename + name_len - from_len, known_extensions[i].to ); return; } } - output_filename = resize_buffer( output_filename, strlen( name ) + 4 + 1 ); + output_filename = resize_buffer( output_filename, name_len + 4 + 1 ); strcpy( output_filename, name ); strcat( output_filename, ".out" ); if( verbosity >= 1 ) @@ -414,8 +420,7 @@ static int decompress( const int buffer_size, const int infd, retval = 2; break; } if( verbosity >= 2 || ( verbosity == 1 && first_member ) ) - { Pp_show_msg( pp, 0 ); - if( verbosity >= 3 ) show_header( dictionary_size ); } + { Pp_show_msg( pp, 0 ); show_header( dictionary_size ); } if( !LZd_init( &decoder, &rdec, buffer_size, dictionary_size, outfd ) ) { diff --git a/testsuite/check.sh b/testsuite/check.sh index 76ab094..bdf4fdc 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -1,6 +1,6 @@ #! /bin/sh # check script for Lunzip - Decompressor for lzip files -# Copyright (C) 2010, 2011, 2012, 2013, 2014 Antonio Diaz Diaz. +# Copyright (C) 2010-2015 Antonio Diaz Diaz. # # This script is free software: you have unlimited permission # to copy, distribute and modify it. |