1
0
Fork 0

Adding upstream version 1.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-17 19:15:56 +01:00
parent f85da0a847
commit fb1abbc107
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
14 changed files with 74 additions and 73 deletions

View file

@ -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. * Version 1.1 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.
* Code has been converted to `C89 + long long' from C99. * Code has been converted to `C89 + long long' from C99.
* main.c: Fixed warning about fchown return value being ignored. * main.c: Fixed warning about fchown return value being ignored.
* decoder.c: `-tvvvv' now shows compression ratio. * decoder.c: `-tvvvv' now shows compression ratio.
@ -15,16 +9,18 @@
compress less but faster. (-1 now takes 43% less time for only compress less but faster. (-1 now takes 43% less time for only
20% larger compressed size). 20% larger compressed size).
* encoder.c: Compression of option -9 has been slightly increased. * 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. * New examples have been added to the manual.
2010-04-05 Antonio Diaz Diaz <ant_diaz@teleline.es> 2010-04-05 Antonio Diaz Diaz <ant_diaz@teleline.es>
* Version 1.0 released. * Version 1.0 released.
* Initial release. * 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, 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

View file

@ -50,7 +50,7 @@ After running `configure', you can run `make' and `make install' as
explained above. 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, This file is free documentation: you have unlimited permission to copy,
distribute and modify it. distribute and modify it.

2
README
View file

@ -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). 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, This file is free documentation: you have unlimited permission to copy,
distribute and modify it. distribute and modify it.

View file

@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm /* 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 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
@ -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 */ typedef uint8_t File_header[6]; /* 0-3 magic bytes */
/* 4 version */ /* 4 version */
/* 5 coded_dict_size; */ /* 5 coded_dict_size */
enum { Fh_size = 6 }; enum { Fh_size = 6 };
static inline void Fh_set_magic( File_header data ) static inline void Fh_set_magic( File_header data )

8
configure vendored
View file

@ -1,16 +1,14 @@
#! /bin/sh #! /bin/sh
# configure script for Clzip - Data compressor based on the LZMA algorithm # 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 # This configure script is free software: you have unlimited permission
# to copy, distribute and modify it. # to copy, distribute and modify it.
#
# Date of this version: 2010-12-07
args= args=
no_create= no_create=
pkgname=clzip pkgname=clzip
pkgversion=1.1-rc2 pkgversion=1.1
progname=clzip progname=clzip
srctrigger=clzip.h srctrigger=clzip.h
@ -167,7 +165,7 @@ echo "LDFLAGS = ${LDFLAGS}"
rm -f Makefile rm -f Makefile
cat > Makefile << EOF cat > Makefile << EOF
# Makefile for Clzip - Data compressor based on the LZMA algorithm # 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 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

View file

@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm /* 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 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

View file

@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm /* 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 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

View file

@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1. .\" 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 .SH NAME
Clzip \- reduces the size of files Clzip \- reduces the size of files
.SH SYNOPSIS .SH SYNOPSIS
@ -31,7 +31,7 @@ overwrite existing output files
keep (don't delete) input files keep (don't delete) input files
.TP .TP
\fB\-m\fR, \fB\-\-match\-length=\fR<n> \fB\-m\fR, \fB\-\-match\-length=\fR<n>
set match length limit in bytes [80] set match length limit in bytes [36]
.TP .TP
\fB\-o\fR, \fB\-\-output=\fR<file> \fB\-o\fR, \fB\-\-output=\fR<file>
if reading stdin, place the output into <file> if reading stdin, place the output into <file>
@ -69,7 +69,7 @@ Report bugs to lzip\-bug@nongnu.org
.br .br
Clzip home page: http://www.nongnu.org/lzip/clzip.html Clzip home page: http://www.nongnu.org/lzip/clzip.html
.SH COPYRIGHT .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> License GPLv3+: GNU GPL version 3 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.

View file

@ -12,7 +12,7 @@ File: clzip.info, Node: Top, Next: Introduction, Up: (dir)
Clzip Manual 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: * Menu:
@ -25,7 +25,7 @@ This manual is for Clzip (version 1.1-rc2, 7 December 2010).
* Concept Index:: Index of concepts * 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 This manual is free documentation: you have unlimited permission to
copy, distribute and modify it. 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 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 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 dictionary size limit, else 2) plus 8 times the dictionary size really
used. For decompression it is a little more than the dictionary size used. The amount of memory required for decompression is only a few tens
really used. of KiB larger than the dictionary size really used.
Clzip will automatically use the smallest possible dictionary size Clzip will automatically use the smallest possible dictionary size
without exceeding the given limit. Keep in mind that the decompression without exceeding the given limit. Keep in mind that the decompression
@ -477,12 +477,12 @@ Concept Index
 
Tag Table: Tag Table:
Node: Top226 Node: Top226
Node: Introduction905 Node: Introduction907
Node: Algorithm4439 Node: Algorithm4484
Node: Invoking Clzip6963 Node: Invoking Clzip7008
Node: File Format11904 Node: File Format11949
Node: Examples13860 Node: Examples13905
Node: Problems15629 Node: Problems15674
Node: Concept Index16155 Node: Concept Index16200
 
End Tag Table End Tag Table

View file

@ -5,8 +5,8 @@
@finalout @finalout
@c %**end of header @c %**end of header
@set UPDATED 7 December 2010 @set UPDATED 11 January 2011
@set VERSION 1.1-rc2 @set VERSION 1.1
@dircategory Data Compression @dircategory Data Compression
@direntry @direntry
@ -44,7 +44,7 @@ This manual is for Clzip (version @value{VERSION}, @value{UPDATED}).
@end menu @end menu
@sp 1 @sp 1
Copyright @copyright{} 2010 Antonio Diaz Diaz. Copyright @copyright{} 2010, 2011 Antonio Diaz Diaz.
This manual is free documentation: you have unlimited permission This manual is free documentation: you have unlimited permission
to copy, distribute and modify it. 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 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 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 dictionary size limit, else 2) plus 8 times the dictionary size really
used. For decompression it is a little more than the dictionary size used. The amount of memory required for decompression is only a few tens
really used. of KiB larger than the dictionary size really used.
Clzip will automatically use the smallest possible dictionary size Clzip will automatically use the smallest possible dictionary size
without exceeding the given limit. Keep in mind that the decompression without exceeding the given limit. Keep in mind that the decompression

View file

@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm /* 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 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

View file

@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm /* 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 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

67
main.c
View file

@ -1,5 +1,5 @@
/* Clzip - Data compressor based on the LZMA algorithm /* 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 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
@ -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_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; const char * invocation_name = 0;
#ifdef O_BINARY #ifdef O_BINARY
@ -104,10 +104,15 @@ bool delete_output_on_interrupt = false;
/* assure at least a minimum size for buffer `buf' */ /* 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 ); if( buf ) buf = realloc( buf, min_size );
else buf = malloc( min_size ); else buf = malloc( min_size );
if( !buf )
{
show_error( "Not enough memory.", 0, false );
cleanup_and_fail( 1 );
}
return buf; return buf;
} }
@ -124,7 +129,7 @@ static void show_help()
printf( " -d, --decompress decompress\n" ); printf( " -d, --decompress decompress\n" );
printf( " -f, --force overwrite existing output files\n" ); printf( " -f, --force overwrite existing output files\n" );
printf( " -k, --keep keep (don't delete) input 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( " -o, --output=<file> if reading stdin, place the output into <file>\n" );
printf( " -q, --quiet suppress all messages\n" ); printf( " -q, --quiet suppress all messages\n" );
printf( " -s, --dictionary-size=<n> set dictionary size limit in bytes [8MiB]\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, static int open_instream( const char * const name, struct stat * const in_statsp,
const enum Mode program_mode, const int eindex, const enum Mode program_mode, const int eindex,
const bool force, const bool to_stdout ) 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 ) static void set_d_outname( const char * const name, const int i )
{ {
if( i >= 0 ) if( i >= 0 )
@ -386,9 +391,10 @@ static void close_and_set_permissions( const struct stat * const in_statsp )
bool error = false; bool error = false;
if( in_statsp ) if( in_statsp )
{ {
if( fchmod( outfd, in_statsp->st_mode ) != 0 || if( ( fchown( outfd, in_statsp->st_uid, in_statsp->st_gid ) != 0 &&
( fchown( outfd, in_statsp->st_uid, in_statsp->st_gid ) != 0 && errno != EPERM ) ||
errno != EPERM ) ) error = true; fchmod( outfd, in_statsp->st_mode ) != 0 )
error = true;
/* fchown will in many cases return with EPERM, which can be safely ignored. */ /* fchown will in many cases return with EPERM, which can be safely ignored. */
} }
if( close( outfd ) == 0 ) outfd = -1; 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" ); fprintf( stderr, "\n" );
} }
if( help && invocation_name && invocation_name[0] ) 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 readblock( const int fd, uint8_t * const buf, const int size )
{ {
int rest = size; int rest = size;
errno = 0; while( true )
while( rest > 0 )
{ {
int n; int n;
errno = 0; errno = 0;
if( rest <= 0 ) break;
n = read( fd, buf + size - rest, rest ); n = read( fd, buf + size - rest, rest );
if( n > 0 ) rest -= n; if( n > 0 ) rest -= n;
else if( n == 0 ) break; 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 writeblock( const int fd, const uint8_t * const buf, const int size )
{ {
int rest = size; int rest = size;
errno = 0; while( true )
while( rest > 0 )
{ {
int n; int n;
errno = 0; errno = 0;
if( rest <= 0 ) break;
n = write( fd, buf + size - rest, rest ); n = write( fd, buf + size - rest, rest );
if( n > 0 ) rest -= n; if( n > 0 ) rest -= n;
else if( errno && errno != EINTR && errno != EAGAIN ) break; 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" */ struct Lzma_options encoder_options = option_mapping[6]; /* default = "-6" */
long long member_size = LLONG_MAX; long long member_size = LLONG_MAX;
long long volume_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; int infd = -1;
enum Mode program_mode = m_compress; enum Mode program_mode = m_compress;
int argind = 0; int argind = 0;
@ -714,10 +725,6 @@ int main( const int argc, const char * const argv[] )
bool force = false; bool force = false;
bool keep_input_files = false; bool keep_input_files = false;
bool to_stdout = 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; struct Pretty_print pp;
const struct ap_Option options[] = const struct ap_Option options[] =

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# check script for Clzip - Data compressor based on the LZMA algorithm # 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 # This script is free software: you have unlimited permission
# to copy, distribute and modify it. # to copy, distribute and modify it.