summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog16
-rw-r--r--INSTALL2
-rw-r--r--README2
-rw-r--r--clzip.h4
-rwxr-xr-xconfigure8
-rw-r--r--decoder.c2
-rw-r--r--decoder.h2
-rw-r--r--doc/clzip.16
-rw-r--r--doc/clzip.info22
-rw-r--r--doc/clzip.texinfo10
-rw-r--r--encoder.c2
-rw-r--r--encoder.h2
-rw-r--r--main.c67
-rwxr-xr-xtestsuite/check.sh2
14 files changed, 74 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index 341d752..f17cb75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,6 @@
-2010-12-07 Antonio Diaz Diaz <ant_diaz@teleline.es>
+2011-01-11 Antonio Diaz Diaz <ant_diaz@teleline.es>
- * Version 1.1-rc2 released.
- * main.c (open_instream): Do not show the message
- " and `--stdout' was not specified" for directories, etc.
-
-2010-08-08 Antonio Diaz Diaz <ant_diaz@teleline.es>
-
- * Version 1.1-rc1 released.
+ * Version 1.1 released.
* Code has been converted to `C89 + long long' from C99.
* main.c: Fixed warning about fchown return value being ignored.
* decoder.c: `-tvvvv' now shows compression ratio.
@@ -15,16 +9,18 @@
compress less but faster. (-1 now takes 43% less time for only
20% larger compressed size).
* encoder.c: Compression of option -9 has been slightly increased.
+ * main.c (open_instream): Do not show the message
+ " and `--stdout' was not specified" for directories, etc.
* New examples have been added to the manual.
2010-04-05 Antonio Diaz Diaz <ant_diaz@teleline.es>
* Version 1.0 released.
* Initial release.
- * Translated to C from the C++ source for lzip 1.10.
+ * Translated to C from the C++ source of lzip 1.10.
-Copyright (C) 2010 Antonio Diaz Diaz.
+Copyright (C) 2010, 2011 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
diff --git a/INSTALL b/INSTALL
index 7582678..dee400d 100644
--- a/INSTALL
+++ b/INSTALL
@@ -50,7 +50,7 @@ After running `configure', you can run `make' and `make install' as
explained above.
-Copyright (C) 2010 Antonio Diaz Diaz.
+Copyright (C) 2010, 2011 Antonio Diaz Diaz.
This file is free documentation: you have unlimited permission to copy,
distribute and modify it.
diff --git a/README b/README
index a503945..bb97dfc 100644
--- a/README
+++ b/README
@@ -65,7 +65,7 @@ range encoding), Igor Pavlov (for putting all the above together in
LZMA), and Julian Seward (for bzip2's CLI and the idea of unzcrash).
-Copyright (C) 2010 Antonio Diaz Diaz.
+Copyright (C) 2010, 2011 Antonio Diaz Diaz.
This file is free documentation: you have unlimited permission to copy,
distribute and modify it.
diff --git a/clzip.h b/clzip.h
index 223cafd..3a7fc4a 100644
--- a/clzip.h
+++ b/clzip.h
@@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm
- Copyright (C) 2010 Antonio Diaz Diaz.
+ Copyright (C) 2010, 2011 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
@@ -172,7 +172,7 @@ static const uint8_t magic_string[4] = { 'L', 'Z', 'I', 'P' };
typedef uint8_t File_header[6]; /* 0-3 magic bytes */
/* 4 version */
- /* 5 coded_dict_size; */
+ /* 5 coded_dict_size */
enum { Fh_size = 6 };
static inline void Fh_set_magic( File_header data )
diff --git a/configure b/configure
index ac8a859..9364735 100755
--- a/configure
+++ b/configure
@@ -1,16 +1,14 @@
#! /bin/sh
# configure script for Clzip - Data compressor based on the LZMA algorithm
-# Copyright (C) 2010 Antonio Diaz Diaz.
+# Copyright (C) 2010, 2011 Antonio Diaz Diaz.
#
# This configure script is free software: you have unlimited permission
# to copy, distribute and modify it.
-#
-# Date of this version: 2010-12-07
args=
no_create=
pkgname=clzip
-pkgversion=1.1-rc2
+pkgversion=1.1
progname=clzip
srctrigger=clzip.h
@@ -167,7 +165,7 @@ echo "LDFLAGS = ${LDFLAGS}"
rm -f Makefile
cat > Makefile << EOF
# Makefile for Clzip - Data compressor based on the LZMA algorithm
-# Copyright (C) 2010 Antonio Diaz Diaz.
+# Copyright (C) 2010, 2011 Antonio Diaz Diaz.
# This file was generated automatically by configure. Do not edit.
#
# This Makefile is free software: you have unlimited permission
diff --git a/decoder.c b/decoder.c
index a98b0a7..454b5f6 100644
--- a/decoder.c
+++ b/decoder.c
@@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm
- Copyright (C) 2010 Antonio Diaz Diaz.
+ Copyright (C) 2010, 2011 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
diff --git a/decoder.h b/decoder.h
index 3691e15..bef12c9 100644
--- a/decoder.h
+++ b/decoder.h
@@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm
- Copyright (C) 2010 Antonio Diaz Diaz.
+ Copyright (C) 2010, 2011 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
diff --git a/doc/clzip.1 b/doc/clzip.1
index 42e2126..fa126e6 100644
--- a/doc/clzip.1
+++ b/doc/clzip.1
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
-.TH CLZIP "1" "December 2010" "Clzip 1.1-rc2" "User Commands"
+.TH CLZIP "1" "January 2011" "Clzip 1.1" "User Commands"
.SH NAME
Clzip \- reduces the size of files
.SH SYNOPSIS
@@ -31,7 +31,7 @@ overwrite existing output files
keep (don't delete) input files
.TP
\fB\-m\fR, \fB\-\-match\-length=\fR<n>
-set match length limit in bytes [80]
+set match length limit in bytes [36]
.TP
\fB\-o\fR, \fB\-\-output=\fR<file>
if reading stdin, place the output into <file>
@@ -69,7 +69,7 @@ Report bugs to lzip\-bug@nongnu.org
.br
Clzip home page: http://www.nongnu.org/lzip/clzip.html
.SH COPYRIGHT
-Copyright \(co 2010 Antonio Diaz Diaz.
+Copyright \(co 2011 Antonio Diaz Diaz.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
.br
This is free software: you are free to change and redistribute it.
diff --git a/doc/clzip.info b/doc/clzip.info
index b7ad665..861aac7 100644
--- a/doc/clzip.info
+++ b/doc/clzip.info
@@ -12,7 +12,7 @@ File: clzip.info, Node: Top, Next: Introduction, Up: (dir)
Clzip Manual
************
-This manual is for Clzip (version 1.1-rc2, 7 December 2010).
+This manual is for Clzip (version 1.1, 11 January 2011).
* Menu:
@@ -25,7 +25,7 @@ This manual is for Clzip (version 1.1-rc2, 7 December 2010).
* Concept Index:: Index of concepts
- Copyright (C) 2010 Antonio Diaz Diaz.
+ Copyright (C) 2010, 2011 Antonio Diaz Diaz.
This manual is free documentation: you have unlimited permission to
copy, distribute and modify it.
@@ -73,8 +73,8 @@ multivolume compressed tar archives.
The amount of memory required for compression is about 5 MiB plus 1
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 it is a little more than the dictionary size
-really used.
+used. The amount of memory required for decompression is only a few tens
+of KiB larger than the dictionary size really used.
Clzip will automatically use the smallest possible dictionary size
without exceeding the given limit. Keep in mind that the decompression
@@ -477,12 +477,12 @@ Concept Index

Tag Table:
Node: Top226
-Node: Introduction905
-Node: Algorithm4439
-Node: Invoking Clzip6963
-Node: File Format11904
-Node: Examples13860
-Node: Problems15629
-Node: Concept Index16155
+Node: Introduction907
+Node: Algorithm4484
+Node: Invoking Clzip7008
+Node: File Format11949
+Node: Examples13905
+Node: Problems15674
+Node: Concept Index16200

End Tag Table
diff --git a/doc/clzip.texinfo b/doc/clzip.texinfo
index 55cbb79..1177d8a 100644
--- a/doc/clzip.texinfo
+++ b/doc/clzip.texinfo
@@ -5,8 +5,8 @@
@finalout
@c %**end of header
-@set UPDATED 7 December 2010
-@set VERSION 1.1-rc2
+@set UPDATED 11 January 2011
+@set VERSION 1.1
@dircategory Data Compression
@direntry
@@ -44,7 +44,7 @@ This manual is for Clzip (version @value{VERSION}, @value{UPDATED}).
@end menu
@sp 1
-Copyright @copyright{} 2010 Antonio Diaz Diaz.
+Copyright @copyright{} 2010, 2011 Antonio Diaz Diaz.
This manual is free documentation: you have unlimited permission
to copy, distribute and modify it.
@@ -91,8 +91,8 @@ compressed tar archives.
The amount of memory required for compression is about 5 MiB plus 1 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 it is a little more than the dictionary size
-really used.
+used. The amount of memory required for decompression is only a few tens
+of KiB larger than the dictionary size really used.
Clzip will automatically use the smallest possible dictionary size
without exceeding the given limit. Keep in mind that the decompression
diff --git a/encoder.c b/encoder.c
index d05d4af..597a173 100644
--- a/encoder.c
+++ b/encoder.c
@@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm
- Copyright (C) 2010 Antonio Diaz Diaz.
+ Copyright (C) 2010, 2011 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
diff --git a/encoder.h b/encoder.h
index ebd6a69..daaf10b 100644
--- a/encoder.h
+++ b/encoder.h
@@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm
- Copyright (C) 2010 Antonio Diaz Diaz.
+ Copyright (C) 2010, 2011 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
diff --git a/main.c b/main.c
index b4737f8..79a32bd 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm
- Copyright (C) 2010 Antonio Diaz Diaz.
+ Copyright (C) 2010, 2011 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
@@ -74,7 +74,7 @@ long long int llabs( long long int number );
const char * const Program_name = "Clzip";
const char * const program_name = "clzip";
-const char * const program_year = "2010";
+const char * const program_year = "2011";
const char * invocation_name = 0;
#ifdef O_BINARY
@@ -104,10 +104,15 @@ bool delete_output_on_interrupt = false;
/* assure at least a minimum size for buffer `buf' */
-inline void * resize_buffer( void * buf, const int min_size )
+static void * resize_buffer( void * buf, const int min_size )
{
if( buf ) buf = realloc( buf, min_size );
else buf = malloc( min_size );
+ if( !buf )
+ {
+ show_error( "Not enough memory.", 0, false );
+ cleanup_and_fail( 1 );
+ }
return buf;
}
@@ -124,7 +129,7 @@ static void show_help()
printf( " -d, --decompress decompress\n" );
printf( " -f, --force overwrite existing output files\n" );
printf( " -k, --keep keep (don't delete) input files\n" );
- printf( " -m, --match-length=<n> set match length limit in bytes [80]\n" );
+ printf( " -m, --match-length=<n> set match length limit in bytes [36]\n" );
printf( " -o, --output=<file> if reading stdin, place the output into <file>\n" );
printf( " -q, --quiet suppress all messages\n" );
printf( " -s, --dictionary-size=<n> set dictionary size limit in bytes [8MiB]\n" );
@@ -237,20 +242,6 @@ static int get_dict_size( const char * const arg )
}
-static int extension_index( const char * const name )
- {
- int i;
- 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 )
- return i;
- }
- return -1;
- }
-
-
static int open_instream( const char * const name, struct stat * const in_statsp,
const enum Mode program_mode, const int eindex,
const bool force, const bool to_stdout )
@@ -304,6 +295,20 @@ static void set_c_outname( const char * const name, const bool multifile )
}
+static int extension_index( const char * const name )
+ {
+ int i;
+ 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 )
+ return i;
+ }
+ return -1;
+ }
+
+
static void set_d_outname( const char * const name, const int i )
{
if( i >= 0 )
@@ -386,9 +391,10 @@ static void close_and_set_permissions( const struct stat * const in_statsp )
bool error = false;
if( in_statsp )
{
- if( fchmod( outfd, in_statsp->st_mode ) != 0 ||
- ( fchown( outfd, in_statsp->st_uid, in_statsp->st_gid ) != 0 &&
- errno != EPERM ) ) error = true;
+ if( ( fchown( outfd, in_statsp->st_uid, in_statsp->st_gid ) != 0 &&
+ errno != EPERM ) ||
+ fchmod( outfd, in_statsp->st_mode ) != 0 )
+ error = true;
/* fchown will in many cases return with EPERM, which can be safely ignored. */
}
if( close( outfd ) == 0 ) outfd = -1;
@@ -634,7 +640,8 @@ void show_error( const char * const msg, const int errcode, const bool help )
fprintf( stderr, "\n" );
}
if( help && invocation_name && invocation_name[0] )
- fprintf( stderr, "Try `%s --help' for more information.\n", invocation_name );
+ fprintf( stderr, "Try `%s --help' for more information.\n",
+ invocation_name );
}
}
@@ -653,11 +660,11 @@ void internal_error( const char * const msg )
int readblock( const int fd, uint8_t * const buf, const int size )
{
int rest = size;
- errno = 0;
- while( rest > 0 )
+ while( true )
{
int n;
errno = 0;
+ if( rest <= 0 ) break;
n = read( fd, buf + size - rest, rest );
if( n > 0 ) rest -= n;
else if( n == 0 ) break;
@@ -673,11 +680,11 @@ int readblock( const int fd, uint8_t * const buf, const int size )
int writeblock( const int fd, const uint8_t * const buf, const int size )
{
int rest = size;
- errno = 0;
- while( rest > 0 )
+ while( true )
{
int n;
errno = 0;
+ if( rest <= 0 ) break;
n = write( fd, buf + size - rest, rest );
if( n > 0 ) rest -= n;
else if( errno && errno != EINTR && errno != EAGAIN ) break;
@@ -705,6 +712,10 @@ int main( const int argc, const char * const argv[] )
struct Lzma_options encoder_options = option_mapping[6]; /* default = "-6" */
long long member_size = LLONG_MAX;
long long volume_size = LLONG_MAX;
+ const char * input_filename = "";
+ const char * default_output_filename = "";
+ const char ** filenames = 0;
+ int num_filenames = 0;
int infd = -1;
enum Mode program_mode = m_compress;
int argind = 0;
@@ -714,10 +725,6 @@ int main( const int argc, const char * const argv[] )
bool force = false;
bool keep_input_files = false;
bool to_stdout = false;
- const char * input_filename = "";
- const char * default_output_filename = "";
- const char ** filenames = 0;
- int num_filenames = 0;
struct Pretty_print pp;
const struct ap_Option options[] =
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 6f9cb1c..4d1377e 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -1,6 +1,6 @@
#! /bin/sh
# check script for Clzip - Data compressor based on the LZMA algorithm
-# Copyright (C) 2010 Antonio Diaz Diaz.
+# Copyright (C) 2010, 2011 Antonio Diaz Diaz.
#
# This script is free software: you have unlimited permission
# to copy, distribute and modify it.