Adding upstream version 1.7~pre1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2fbd73b719
commit
fb1ab62938
14 changed files with 115 additions and 69 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>
|
2014-07-01 Antonio Diaz Diaz <antonio@gnu.org>
|
||||||
|
|
||||||
* Version 1.6 released.
|
* Version 1.6 released.
|
||||||
|
@ -48,7 +54,7 @@
|
||||||
* Created from the decompression code of clzip 1.1.
|
* 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,
|
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
|
but just in case, you have unlimited permission to copy, distribute and
|
||||||
|
|
13
INSTALL
13
INSTALL
|
@ -1,7 +1,7 @@
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
You will need a C compiler.
|
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.
|
standards compliant compiler.
|
||||||
Gcc is available at http://gcc.gnu.org.
|
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
|
5. Type 'make install' to install the program and any data files and
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
You can install only the program, the info manual or the man page
|
Or type 'make install-compress', which additionally compresses the
|
||||||
typing 'make install-bin', 'make install-info' or 'make install-man'
|
man page after installation. (Installing compressed docs may become
|
||||||
respectively.
|
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
|
Instead of 'make install', you can type 'make install-as-lzip' to
|
||||||
install the program and any data files and documentation, and link
|
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.
|
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,
|
This file is free documentation: you have unlimited permission to copy,
|
||||||
distribute and modify it.
|
distribute and modify it.
|
||||||
|
|
30
Makefile.in
30
Makefile.in
|
@ -9,7 +9,9 @@ SHELL = /bin/sh
|
||||||
objs = carg_parser.o decoder.o main.o
|
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 \
|
install-as-lzip uninstall uninstall-bin uninstall-info uninstall-man \
|
||||||
doc info man check dist clean distclean
|
doc info man check dist clean distclean
|
||||||
|
|
||||||
|
@ -18,9 +20,6 @@ all : $(progname)
|
||||||
$(progname) : $(objs)
|
$(progname) : $(objs)
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(objs)
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(objs)
|
||||||
|
|
||||||
$(progname)_profiled : $(objs)
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -pg -o $@ $(objs)
|
|
||||||
|
|
||||||
main.o : main.c
|
main.o : main.c
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -DPROGVERSION=\"$(pkgversion)\" -c -o $@ $<
|
$(CC) $(CFLAGS) $(CPPFLAGS) -DPROGVERSION=\"$(pkgversion)\" -c -o $@ $<
|
||||||
|
|
||||||
|
@ -52,38 +51,49 @@ check : all
|
||||||
@$(VPATH)/testsuite/check.sh $(VPATH)/testsuite $(pkgversion)
|
@$(VPATH)/testsuite/check.sh $(VPATH)/testsuite $(pkgversion)
|
||||||
|
|
||||||
install : install-bin install-man
|
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
|
install-bin : all
|
||||||
if [ ! -d "$(DESTDIR)$(bindir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(bindir)" ; fi
|
if [ ! -d "$(DESTDIR)$(bindir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(bindir)" ; fi
|
||||||
$(INSTALL_PROGRAM) ./$(progname) "$(DESTDIR)$(bindir)/$(progname)"
|
$(INSTALL_PROGRAM) ./$(progname) "$(DESTDIR)$(bindir)/$(progname)"
|
||||||
|
|
||||||
|
install-bin-strip : all
|
||||||
|
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install-bin
|
||||||
|
|
||||||
install-info :
|
install-info :
|
||||||
if [ ! -d "$(DESTDIR)$(infodir)" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(infodir)" ; fi
|
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_DATA) $(VPATH)/doc/$(pkgname).info "$(DESTDIR)$(infodir)/$(pkgname).info"
|
||||||
-install-info --info-dir="$(DESTDIR)$(infodir)" "$(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 :
|
install-man :
|
||||||
if [ ! -d "$(DESTDIR)$(mandir)/man1" ] ; then $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1" ; fi
|
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_DATA) $(VPATH)/doc/$(progname).1 "$(DESTDIR)$(mandir)/man1/$(progname).1"
|
||||||
|
|
||||||
install-strip : all
|
install-man-compress : install-man
|
||||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
|
lzip -v -9 "$(DESTDIR)$(mandir)/man1/$(progname).1"
|
||||||
|
|
||||||
install-as-lzip : install
|
install-as-lzip : install
|
||||||
-rm -f "$(DESTDIR)$(bindir)/lzip"
|
-rm -f "$(DESTDIR)$(bindir)/lzip"
|
||||||
cd "$(DESTDIR)$(bindir)" && ln -s $(progname) lzip
|
cd "$(DESTDIR)$(bindir)" && ln -s $(progname) lzip
|
||||||
|
|
||||||
uninstall : uninstall-bin uninstall-man
|
uninstall : uninstall-man uninstall-bin
|
||||||
|
|
||||||
uninstall-bin :
|
uninstall-bin :
|
||||||
-rm -f "$(DESTDIR)$(bindir)/$(progname)"
|
-rm -f "$(DESTDIR)$(bindir)/$(progname)"
|
||||||
|
|
||||||
uninstall-info :
|
uninstall-info :
|
||||||
-install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$(pkgname).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 :
|
uninstall-man :
|
||||||
-rm -f "$(DESTDIR)$(mandir)/man1/$(progname).1"
|
-rm -f "$(DESTDIR)$(mandir)/man1/$(progname).1"*
|
||||||
|
|
||||||
dist : doc
|
dist : doc
|
||||||
ln -sf $(VPATH) $(DISTNAME)
|
ln -sf $(VPATH) $(DISTNAME)
|
||||||
|
@ -106,7 +116,7 @@ dist : doc
|
||||||
lzip -v -9 $(DISTNAME).tar
|
lzip -v -9 $(DISTNAME).tar
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
-rm -f $(progname) $(progname)_profiled $(objs)
|
-rm -f $(progname) $(objs)
|
||||||
|
|
||||||
distclean : clean
|
distclean : clean
|
||||||
-rm -f Makefile config.status *.tar *.tar.lz
|
-rm -f Makefile config.status *.tar *.tar.lz
|
||||||
|
|
7
NEWS
7
NEWS
|
@ -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.
|
||||||
|
|
32
README
32
README
|
@ -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
|
installers that need to decompress files but do not need compression
|
||||||
capabilities. Lunzip is fully compatible with lzip-1.4 or newer.
|
capabilities. Lunzip is fully compatible with lzip-1.4 or newer.
|
||||||
|
|
||||||
The lzip file format is designed for long-term data archiving. It is
|
The lzip file format is designed for data sharing and long-term
|
||||||
clean, provides very safe 4 factor integrity checking, and is backed by
|
archiving, taking into account both data integrity and decoder
|
||||||
the recovery capabilities of lziprecover.
|
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
|
Lunzip uses the same well-defined exit status values used by lzip and
|
||||||
bzip2, which makes it safer than decompressors returning ambiguous
|
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
|
the more accesses to disk are needed and the slower the decompression
|
||||||
is. This "low memory" mode only works when decompressing to a regular
|
is. This "low memory" mode only works when decompressing to a regular
|
||||||
file and is intended for systems without enough memory (RAM + swap) to
|
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
|
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
|
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).
|
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,
|
This file is free documentation: you have unlimited permission to copy,
|
||||||
distribute and modify it.
|
distribute and modify it.
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* Arg_parser - POSIX/GNU command line argument parser. (C version)
|
/* Arg_parser - POSIX/GNU command line argument parser. (C version)
|
||||||
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
|
Copyright (C) 2006-2015 Antonio Diaz Diaz.
|
||||||
Antonio Diaz Diaz.
|
|
||||||
|
|
||||||
This library is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* Arg_parser - POSIX/GNU command line argument parser. (C version)
|
/* Arg_parser - POSIX/GNU command line argument parser. (C version)
|
||||||
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
|
Copyright (C) 2006-2015 Antonio Diaz Diaz.
|
||||||
Antonio Diaz Diaz.
|
|
||||||
|
|
||||||
This library is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
6
configure
vendored
6
configure
vendored
|
@ -1,12 +1,12 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# configure script for Lunzip - Decompressor for lzip files
|
# 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
|
# This configure script is free software: you have unlimited permission
|
||||||
# to copy, distribute and modify it.
|
# to copy, distribute and modify it.
|
||||||
|
|
||||||
pkgname=lunzip
|
pkgname=lunzip
|
||||||
pkgversion=1.6
|
pkgversion=1.7-pre1
|
||||||
progname=lunzip
|
progname=lunzip
|
||||||
srctrigger=doc/${progname}.1
|
srctrigger=doc/${progname}.1
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ echo "LDFLAGS = ${LDFLAGS}"
|
||||||
rm -f Makefile
|
rm -f Makefile
|
||||||
cat > Makefile << EOF
|
cat > Makefile << EOF
|
||||||
# Makefile for Lunzip - Decompressor for lzip files
|
# 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 file was generated automatically by configure. Do not edit.
|
||||||
#
|
#
|
||||||
# This Makefile is free software: you have unlimited permission
|
# This Makefile is free software: you have unlimited permission
|
||||||
|
|
10
decoder.c
10
decoder.c
|
@ -1,5 +1,5 @@
|
||||||
/* Lunzip - Decompressor for lzip files
|
/* 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
|
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
|
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;
|
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 */
|
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 ) )
|
if( St_is_char( state ) )
|
||||||
{
|
{
|
||||||
state -= ( state < 4 ) ? state : 3;
|
state -= ( state < 4 ) ? state : 3;
|
||||||
|
@ -234,7 +234,7 @@ int LZd_decode_member( struct LZ_decoder * const d,
|
||||||
state -= ( state < 10 ) ? 3 : 6;
|
state -= ( state < 10 ) ? 3 : 6;
|
||||||
LZd_put_byte( d, Rd_decode_matched( rdec,
|
LZd_put_byte( d, Rd_decode_matched( rdec,
|
||||||
d->bm_literal[get_lit_state(prev_byte)],
|
d->bm_literal[get_lit_state(prev_byte)],
|
||||||
LZd_get_byte( d, rep0 ) ) );
|
LZd_peek( d, rep0 ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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 */
|
if( Rd_decode_bit( rdec, &d->bm_len[state][pos_state] ) == 0 ) /* 4th bit */
|
||||||
{ state = St_set_short_rep( state );
|
{ 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 );
|
state = St_set_rep( state );
|
||||||
len = min_match_len + Rd_decode_len( rdec, &d->rep_len_model, pos_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( rdec, direct_bits - dis_align_bits ) << dis_align_bits;
|
||||||
rep0 += Rd_decode_tree_reversed4( rdec, d->bm_align );
|
rep0 += Rd_decode_tree_reversed4( rdec, d->bm_align );
|
||||||
if( rep0 == 0xFFFFFFFFU ) /* Marker found */
|
if( rep0 == 0xFFFFFFFFU ) /* marker found */
|
||||||
{
|
{
|
||||||
rep0 = rep0_saved;
|
rep0 = rep0_saved;
|
||||||
Rd_normalize( rdec );
|
Rd_normalize( rdec );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Lunzip - Decompressor for lzip files
|
/* 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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -259,13 +259,13 @@ void LZd_flush_data( struct LZ_decoder * const d );
|
||||||
int seek_read( const int fd, uint8_t * const buf, const int size,
|
int seek_read( const int fd, uint8_t * const buf, const int size,
|
||||||
const int offset );
|
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;
|
const int i = ( ( d->pos > 0 ) ? d->pos : d->buffer_size ) - 1;
|
||||||
return d->buffer[i];
|
return d->buffer[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8_t LZd_get_byte( const struct LZ_decoder * const d,
|
static inline uint8_t LZd_peek( const struct LZ_decoder * const d,
|
||||||
const int distance )
|
const int distance )
|
||||||
{
|
{
|
||||||
uint8_t b;
|
uint8_t b;
|
||||||
|
@ -319,7 +319,7 @@ static inline void LZd_copy_block2( struct LZ_decoder * const d,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for( ; len > 0; --len )
|
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,
|
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_slot[0], len_states * (1 << dis_slot_bits) );
|
||||||
Bm_array_init( d->bm_dis, modeled_distances - end_dis_model );
|
Bm_array_init( d->bm_dis, modeled_distances - end_dis_model );
|
||||||
Bm_array_init( d->bm_align, dis_align_size );
|
Bm_array_init( d->bm_align, dis_align_size );
|
||||||
|
|
||||||
Lm_init( &d->match_len_model );
|
Lm_init( &d->match_len_model );
|
||||||
Lm_init( &d->rep_len_model );
|
Lm_init( &d->rep_len_model );
|
||||||
d->buffer[d->buffer_size-1] = 0; /* prev_byte of first byte */
|
d->buffer[d->buffer_size-1] = 0; /* prev_byte of first byte */
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1.
|
||||||
.TH LUNZIP "1" "July 2014" "lunzip 1.6" "User Commands"
|
.TH LUNZIP "1" "March 2015" "lunzip 1.7-pre1" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
lunzip \- decompressor for lzip files
|
lunzip \- decompressor for lzip files
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B lunzip
|
.B lunzip
|
||||||
[\fIoptions\fR] [\fIfiles\fR]
|
[\fI\,options\/\fR] [\fI\,files\/\fR]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Lunzip is a decompressor for lzip files. It is written in C and its
|
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
|
small size makes it well suited for embedded devices or software
|
||||||
|
@ -68,7 +68,7 @@ Report bugs to lzip\-bug@nongnu.org
|
||||||
.br
|
.br
|
||||||
Lunzip home page: http://www.nongnu.org/lzip/lunzip.html
|
Lunzip home page: http://www.nongnu.org/lzip/lunzip.html
|
||||||
.SH COPYRIGHT
|
.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>
|
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||||
.br
|
.br
|
||||||
This is free software: you are free to change and redistribute it.
|
This is free software: you are free to change and redistribute it.
|
||||||
|
|
2
lzip.h
2
lzip.h
|
@ -1,5 +1,5 @@
|
||||||
/* Lunzip - Decompressor for lzip files
|
/* 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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
27
main.c
27
main.c
|
@ -1,5 +1,5 @@
|
||||||
/* Lunzip - Decompressor for lzip files
|
/* 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
|
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
|
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_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;
|
const char * invocation_name = 0;
|
||||||
|
|
||||||
struct { const char * from; const char * to; } const known_extensions[] = {
|
struct { const char * from; const char * to; } const known_extensions[] = {
|
||||||
|
@ -133,6 +133,8 @@ static void show_version( void )
|
||||||
|
|
||||||
|
|
||||||
static void show_header( const unsigned dictionary_size )
|
static void show_header( const unsigned dictionary_size )
|
||||||
|
{
|
||||||
|
if( verbosity >= 3 )
|
||||||
{
|
{
|
||||||
const char * const prefix[8] =
|
const char * const prefix[8] =
|
||||||
{ "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi" };
|
{ "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi", "Yi" };
|
||||||
|
@ -147,6 +149,7 @@ static void show_header( const unsigned dictionary_size )
|
||||||
p = prefix[i]; np = ""; }
|
p = prefix[i]; np = ""; }
|
||||||
fprintf( stderr, "dictionary size %s%4u %sB. ", np, num, p );
|
fprintf( stderr, "dictionary size %s%4u %sB. ", np, num, p );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static unsigned long getnum( const char * const ptr,
|
static unsigned long getnum( const char * const ptr,
|
||||||
|
@ -222,8 +225,10 @@ static int extension_index( const char * const name )
|
||||||
for( i = 0; known_extensions[i].from; ++i )
|
for( i = 0; known_extensions[i].from; ++i )
|
||||||
{
|
{
|
||||||
const char * const ext = known_extensions[i].from;
|
const char * const ext = known_extensions[i].from;
|
||||||
if( strlen( name ) > strlen( ext ) &&
|
const unsigned name_len = strlen( name );
|
||||||
strncmp( name + strlen( name ) - strlen( ext ), ext, strlen( ext ) ) == 0 )
|
const unsigned ext_len = strlen( ext );
|
||||||
|
if( name_len > ext_len &&
|
||||||
|
strncmp( name + name_len - ext_len, ext, ext_len ) == 0 )
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
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 )
|
static void set_d_outname( const char * const name, const int i )
|
||||||
{
|
{
|
||||||
|
const unsigned name_len = strlen( name );
|
||||||
if( i >= 0 )
|
if( i >= 0 )
|
||||||
{
|
{
|
||||||
const char * const from = known_extensions[i].from;
|
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 );
|
strlen( known_extensions[0].to ) + 1 );
|
||||||
strcpy( output_filename, name );
|
strcpy( output_filename, name );
|
||||||
strcpy( output_filename + strlen( name ) - strlen( from ),
|
strcpy( output_filename + name_len - from_len, known_extensions[i].to );
|
||||||
known_extensions[i].to );
|
|
||||||
return;
|
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 );
|
strcpy( output_filename, name );
|
||||||
strcat( output_filename, ".out" );
|
strcat( output_filename, ".out" );
|
||||||
if( verbosity >= 1 )
|
if( verbosity >= 1 )
|
||||||
|
@ -414,8 +420,7 @@ static int decompress( const int buffer_size, const int infd,
|
||||||
retval = 2; break; }
|
retval = 2; break; }
|
||||||
|
|
||||||
if( verbosity >= 2 || ( verbosity == 1 && first_member ) )
|
if( verbosity >= 2 || ( verbosity == 1 && first_member ) )
|
||||||
{ Pp_show_msg( pp, 0 );
|
{ Pp_show_msg( pp, 0 ); show_header( dictionary_size ); }
|
||||||
if( verbosity >= 3 ) show_header( dictionary_size ); }
|
|
||||||
|
|
||||||
if( !LZd_init( &decoder, &rdec, buffer_size, dictionary_size, outfd ) )
|
if( !LZd_init( &decoder, &rdec, buffer_size, dictionary_size, outfd ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# check script for Lunzip - Decompressor for lzip files
|
# 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
|
# This script is free software: you have unlimited permission
|
||||||
# to copy, distribute and modify it.
|
# to copy, distribute and modify it.
|
||||||
|
|
Loading…
Add table
Reference in a new issue