Adding upstream version 0.6.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2902fcb6e5
commit
64ab85d0eb
10 changed files with 678 additions and 650 deletions
|
@ -1,3 +1,8 @@
|
|||
2014-08-25 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 0.6 released.
|
||||
* Minor changes.
|
||||
|
||||
2013-09-17 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 0.5 released.
|
||||
|
@ -23,7 +28,7 @@
|
|||
* Version 0.1 released.
|
||||
|
||||
|
||||
Copyright (C) 2013 Antonio Diaz Diaz.
|
||||
Copyright (C) 2013, 2014 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
|
||||
|
|
18
INSTALL
18
INSTALL
|
@ -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,19 +32,19 @@ 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
|
||||
You can install only the program, the info manual or the man page by
|
||||
typing 'make install-bin', 'make install-info' or 'make install-man'
|
||||
respectively.
|
||||
|
||||
|
||||
Another way
|
||||
-----------
|
||||
You can also compile lzd into a separate directory. To do this, you
|
||||
must use a version of 'make' that supports the 'VPATH' variable, such
|
||||
as GNU 'make'. 'cd' to the directory where you want the object files
|
||||
and executables to go and run the 'configure' script. 'configure'
|
||||
automatically checks for the source code in '.', in '..' and in the
|
||||
directory that 'configure' is in.
|
||||
You can also compile lzd into a separate directory.
|
||||
To do this, you must use a version of 'make' that supports the 'VPATH'
|
||||
variable, such as GNU 'make'. 'cd' to the directory where you want the
|
||||
object files and executables to go and run the 'configure' script.
|
||||
'configure' automatically checks for the source code in '.', in '..' and
|
||||
in the directory that 'configure' is in.
|
||||
|
||||
'configure' recognizes the option '--srcdir=DIR' to control where to
|
||||
look for the sources. Usually 'configure' can determine that directory
|
||||
|
@ -54,7 +54,7 @@ After running 'configure', you can run 'make' and 'make install' as
|
|||
explained above.
|
||||
|
||||
|
||||
Copyright (C) 2013 Antonio Diaz Diaz.
|
||||
Copyright (C) 2013, 2014 Antonio Diaz Diaz.
|
||||
|
||||
This file is free documentation: you have unlimited permission to copy,
|
||||
distribute and modify it.
|
||||
|
|
16
Makefile.in
16
Makefile.in
|
@ -1,8 +1,8 @@
|
|||
|
||||
DISTNAME = $(pkgname)-$(pkgversion)
|
||||
INSTALL = install
|
||||
INSTALL_PROGRAM = $(INSTALL) -p -m 755
|
||||
INSTALL_DATA = $(INSTALL) -p -m 644
|
||||
INSTALL_PROGRAM = $(INSTALL) -m 755
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
INSTALL_DIR = $(INSTALL) -d -m 755
|
||||
SHELL = /bin/sh
|
||||
|
||||
|
@ -16,13 +16,13 @@ objs = lzd.o
|
|||
all : $(progname)
|
||||
|
||||
$(progname) : $(objs)
|
||||
$(CXX) $(LDFLAGS) -o $@ $(objs)
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(objs)
|
||||
|
||||
$(progname)_profiled : $(objs)
|
||||
$(CXX) $(LDFLAGS) -pg -o $@ $(objs)
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -pg -o $@ $(objs)
|
||||
|
||||
%.o : %.cc
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -DPROGVERSION=\"$(pkgversion)\" -c -o $@ $<
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -DPROGVERSION=\"$(pkgversion)\" -c -o $@ $<
|
||||
|
||||
$(objs) : Makefile
|
||||
|
||||
|
@ -31,8 +31,8 @@ doc :
|
|||
|
||||
info : $(VPATH)/doc/$(pkgname).info
|
||||
|
||||
$(VPATH)/doc/$(pkgname).info : $(VPATH)/doc/$(pkgname).texinfo
|
||||
cd $(VPATH)/doc && makeinfo $(pkgname).texinfo
|
||||
$(VPATH)/doc/$(pkgname).info : $(VPATH)/doc/$(pkgname).texi
|
||||
cd $(VPATH)/doc && makeinfo $(pkgname).texi
|
||||
|
||||
man : $(VPATH)/doc/$(progname).1
|
||||
|
||||
|
@ -78,7 +78,7 @@ uninstall-man :
|
|||
|
||||
dist : doc
|
||||
ln -sf $(VPATH) $(DISTNAME)
|
||||
tar -cvf $(DISTNAME).tar \
|
||||
tar -Hustar --owner=root --group=root -cvf $(DISTNAME).tar \
|
||||
$(DISTNAME)/AUTHORS \
|
||||
$(DISTNAME)/ChangeLog \
|
||||
$(DISTNAME)/INSTALL \
|
||||
|
|
2
NEWS
2
NEWS
|
@ -1,3 +1,3 @@
|
|||
Changes in version 0.5:
|
||||
Changes in version 0.6:
|
||||
|
||||
Minor changes.
|
||||
|
|
26
README
26
README
|
@ -13,6 +13,30 @@ correctly decompress the concatenation of two or more compressed files.
|
|||
The result is the concatenation of the corresponding decompressed data.
|
||||
Integrity of such concatenated compressed input is also verified.
|
||||
|
||||
The lzip file format is designed for long-term data 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 lzip 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.
|
||||
|
||||
The ideas embodied in lzd are due to (at least) the following people:
|
||||
Abraham Lempel and Jacob Ziv (for the LZ algorithm), Andrey Markov (for
|
||||
the definition of Markov chains), G.N.N. Martin (for the definition of
|
||||
|
@ -20,7 +44,7 @@ range encoding), and Igor Pavlov (for putting all the above together in
|
|||
LZMA).
|
||||
|
||||
|
||||
Copyright (C) 2013 Antonio Diaz Diaz.
|
||||
Copyright (C) 2013, 2014 Antonio Diaz Diaz.
|
||||
|
||||
This file is free documentation: you have unlimited permission to copy,
|
||||
distribute and modify it.
|
||||
|
|
8
configure
vendored
8
configure
vendored
|
@ -1,12 +1,12 @@
|
|||
#! /bin/sh
|
||||
# configure script for Lzd - Educational decompressor for lzip files
|
||||
# Copyright (C) 2013 Antonio Diaz Diaz.
|
||||
# Copyright (C) 2013, 2014 Antonio Diaz Diaz.
|
||||
#
|
||||
# This configure script is free software: you have unlimited permission
|
||||
# to copy, distribute and modify it.
|
||||
|
||||
pkgname=lzd
|
||||
pkgversion=0.5
|
||||
pkgversion=0.6
|
||||
progname=lzd
|
||||
srctrigger=lzd.cc
|
||||
|
||||
|
@ -64,7 +64,7 @@ while [ $# != 0 ] ; do
|
|||
echo " --datarootdir=DIR base directory for doc and data [${datarootdir}]"
|
||||
echo " --infodir=DIR info files directory [${infodir}]"
|
||||
echo " --mandir=DIR man pages directory [${mandir}]"
|
||||
echo " CXX=COMPILER C++ compiler to use [g++]"
|
||||
echo " CXX=COMPILER C++ compiler to use [${CXX}]"
|
||||
echo " CPPFLAGS=OPTIONS command line options for the preprocessor [${CPPFLAGS}]"
|
||||
echo " CXXFLAGS=OPTIONS command line options for the C++ compiler [${CXXFLAGS}]"
|
||||
echo " LDFLAGS=OPTIONS command line options for the linker [${LDFLAGS}]"
|
||||
|
@ -165,7 +165,7 @@ echo "LDFLAGS = ${LDFLAGS}"
|
|||
rm -f Makefile
|
||||
cat > Makefile << EOF
|
||||
# Makefile for Lzd - Educational decompressor for lzip files
|
||||
# Copyright (C) 2013 Antonio Diaz Diaz.
|
||||
# Copyright (C) 2013, 2014 Antonio Diaz Diaz.
|
||||
# This file was generated automatically by configure. Do not edit.
|
||||
#
|
||||
# This Makefile is free software: you have unlimited permission
|
||||
|
|
31
lzd.cc
31
lzd.cc
|
@ -1,5 +1,5 @@
|
|||
/* Lzd - Educational decompressor for lzip files
|
||||
Copyright (C) 2013 Antonio Diaz Diaz.
|
||||
Copyright (C) 2013, 2014 Antonio Diaz Diaz.
|
||||
|
||||
This program is free software: you have unlimited permission
|
||||
to copy, distribute and modify it.
|
||||
|
@ -21,7 +21,7 @@
|
|||
#include <cstring>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#if defined(__MSVCRT__) || defined(__OS2__)
|
||||
#if defined(__MSVCRT__) || defined(__OS2__) || defined(_MSC_VER)
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
@ -213,7 +213,7 @@ public:
|
|||
break;
|
||||
}
|
||||
}
|
||||
return symbol - 0x100;
|
||||
return symbol & 0xFF;
|
||||
}
|
||||
|
||||
int decode_len( Len_model & lm, const int pos_state )
|
||||
|
@ -263,7 +263,7 @@ public:
|
|||
pos( 0 ),
|
||||
stream_pos( 0 ),
|
||||
crc_( 0xFFFFFFFFU )
|
||||
{ buffer[dictionary_size-1] = 0; } // prev_byte of first_byte
|
||||
{ buffer[dictionary_size-1] = 0; } // prev_byte of first byte
|
||||
|
||||
~LZ_decoder() { delete[] buffer; }
|
||||
|
||||
|
@ -282,7 +282,7 @@ void LZ_decoder::flush_data()
|
|||
crc32.update_buf( crc_, buffer + stream_pos, size );
|
||||
errno = 0;
|
||||
if( std::fwrite( buffer + stream_pos, 1, size, stdout ) != size )
|
||||
{ std::fprintf( stderr, "Write error: %s\n", std::strerror( errno ) );
|
||||
{ std::fprintf( stderr, "Write error: %s.\n", std::strerror( errno ) );
|
||||
std::exit( 1 ); }
|
||||
if( pos >= dictionary_size ) { partial_data_pos += pos; pos = 0; }
|
||||
stream_pos = pos;
|
||||
|
@ -380,13 +380,13 @@ bool LZ_decoder::decode_member() // Returns false if error
|
|||
}
|
||||
}
|
||||
state.set_match();
|
||||
if( rep0 >= dictionary_size || ( rep0 >= pos && !partial_data_pos ) )
|
||||
return false;
|
||||
if( rep0 >= dictionary_size || rep0 >= data_position() )
|
||||
{ flush_data(); return false; }
|
||||
}
|
||||
for( int i = 0; i < len; ++i )
|
||||
put_byte( get_byte( rep0 ) );
|
||||
for( int i = 0; i < len; ++i ) put_byte( get_byte( rep0 ) );
|
||||
}
|
||||
}
|
||||
flush_data();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -402,7 +402,7 @@ int main( const int argc, const char * const argv[] )
|
|||
"It is not safe to use lzd for any real work.\n"
|
||||
"\nUsage: %s < file.lz > file\n", argv[0] );
|
||||
std::printf( "Lzd decompresses from standard input to standard output.\n"
|
||||
"\nCopyright (C) 2013 Antonio Diaz Diaz.\n"
|
||||
"\nCopyright (C) 2014 Antonio Diaz Diaz.\n"
|
||||
"This is free software: you are free to change and redistribute it.\n"
|
||||
"There is NO WARRANTY, to the extent permitted by law.\n"
|
||||
"Report bugs to lzip-bug@nongnu.org\n"
|
||||
|
@ -410,16 +410,15 @@ int main( const int argc, const char * const argv[] )
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__MSVCRT__) || defined(__OS2__)
|
||||
setmode( STDIN_FILENO, O_BINARY );
|
||||
setmode( STDOUT_FILENO, O_BINARY );
|
||||
#if defined(__MSVCRT__) || defined(__OS2__) || defined(_MSC_VER)
|
||||
setmode( fileno( stdin ), O_BINARY );
|
||||
setmode( fileno( stdout ), O_BINARY );
|
||||
#endif
|
||||
|
||||
for( bool first_member = true; ; first_member = false )
|
||||
{
|
||||
File_header header;
|
||||
for( int i = 0; i < 6; ++i )
|
||||
header[i] = std::getc( stdin );
|
||||
for( int i = 0; i < 6; ++i ) header[i] = std::getc( stdin );
|
||||
if( std::feof( stdin ) || std::memcmp( header, "LZIP", 4 ) != 0 )
|
||||
{
|
||||
if( first_member )
|
||||
|
@ -454,7 +453,7 @@ int main( const int argc, const char * const argv[] )
|
|||
}
|
||||
|
||||
if( std::fclose( stdout ) != 0 )
|
||||
{ std::fprintf( stderr, "Can't close stdout: %s\n", std::strerror( errno ) );
|
||||
{ std::fprintf( stderr, "Can't close stdout: %s.\n", std::strerror( errno ) );
|
||||
return 1; }
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# check script for Lzd - Educational decompressor for lzip files
|
||||
# Copyright (C) 2013 Antonio Diaz Diaz.
|
||||
# Copyright (C) 2013, 2014 Antonio Diaz Diaz.
|
||||
#
|
||||
# This script is free software: you have unlimited permission
|
||||
# to copy, distribute and modify it.
|
||||
|
@ -12,7 +12,7 @@ testdir=`cd "$1" ; pwd`
|
|||
LZIP="${objdir}"/lzd
|
||||
framework_failure() { echo "failure in testing framework" ; exit 1 ; }
|
||||
|
||||
if [ ! -x "${LZIP}" ] ; then
|
||||
if [ ! -f "${LZIP}" ] || [ ! -x "${LZIP}" ] ; then
|
||||
echo "${LZIP}: cannot execute"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -28,10 +28,10 @@ fail=0
|
|||
printf "testing lzd-%s..." "$2"
|
||||
|
||||
"${LZIP}" < "${in}" 2> /dev/null
|
||||
if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi
|
||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||
dd if="${in_lz}" bs=1 count=6 2> /dev/null | "${LZIP}" 2> /dev/null
|
||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||
dd if="${in_lz}" bs=1 count=20 2> /dev/null | "${LZIP}" 2> /dev/null
|
||||
dd if="${in_lz}" bs=1 count=20 2> /dev/null | "${LZIP}" > /dev/null 2>&1
|
||||
if [ $? = 2 ] ; then printf . ; else printf - ; fail=1 ; fi
|
||||
|
||||
"${LZIP}" < "${in_lz}" > copy || fail=1
|
||||
|
|
1212
testsuite/test.txt
1212
testsuite/test.txt
File diff suppressed because it is too large
Load diff
Binary file not shown.
Loading…
Add table
Reference in a new issue