1
0
Fork 0

Merging upstream version 1.14.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-17 20:53:44 +01:00
parent 02cc7331f8
commit 4fbdc37ab6
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
24 changed files with 98 additions and 112 deletions

View file

@ -1,9 +1,10 @@
2023-12-20 Antonio Diaz Diaz <antonio@gnu.org> 2024-01-22 Antonio Diaz Diaz <antonio@gnu.org>
* Version 1.14-rc1 released. * Version 1.14 released.
* New options '--empty-error' and '--marking-error'. * New options '--empty-error' and '--marking-error'.
* main.c: Reformat file diagnostics as 'PROGRAM: FILE: MESSAGE'. * main.c: Reformat file diagnostics as 'PROGRAM: FILE: MESSAGE'.
(show_option_error): New function showing argument and option name. (show_option_error): New function showing argument and option name.
(main): Make -o preserve date/mode/owner if 1 input file.
(open_outstream): Create missing intermediate directories. (open_outstream): Create missing intermediate directories.
* lzip.h: Rename verify_* to check_*. * lzip.h: Rename verify_* to check_*.
* configure, Makefile.in: New variable 'MAKEINFO'. * configure, Makefile.in: New variable 'MAKEINFO'.
@ -81,8 +82,8 @@
* Version 1.8 released. * Version 1.8 released.
* New option '-a, --trailing-error'. * New option '-a, --trailing-error'.
* main.c (decompress): Print up to 6 bytes of trailing data * main.c (decompress): Print up to 6 bytes of trailing data when
when '-vvvv' is specified. '-vvvv' is specified.
* decoder.c (LZd_verify_trailer): Remove test of final code. * decoder.c (LZd_verify_trailer): Remove test of final code.
* main.c (main): Delete '--output' file if infd is a terminal. * main.c (main): Delete '--output' file if infd is a terminal.
* main.c (main): Don't use stdin more than once. * main.c (main): Don't use stdin more than once.
@ -172,8 +173,7 @@
* Translated to C from the C++ source of lzip 1.10. * Translated to C from the C++ source of lzip 1.10.
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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
but just in case, you have unlimited permission to copy, distribute, and in case, you have unlimited permission to copy, distribute, and modify it.
modify it.

View file

@ -75,7 +75,7 @@ After running 'configure', you can run 'make' and 'make install' as
explained above. explained above.
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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.

3
NEWS
View file

@ -11,6 +11,9 @@ File diagnostics have been reformatted as 'PROGRAM: FILE: MESSAGE'.
Diagnostics caused by invalid arguments to command-line options now show the Diagnostics caused by invalid arguments to command-line options now show the
argument and the name of the option. argument and the name of the option.
The option '-o, --output' now preserves dates, permissions, and ownership of
the file when (de)compressing exactly one file.
The option '-o, --output' now creates missing intermediate directories when The option '-o, --output' now creates missing intermediate directories when
writing to a file. writing to a file.

14
README
View file

@ -1,9 +1,8 @@
Description Description
Clzip is a C language version of lzip, fully compatible with lzip 1.4 or Clzip is a C language version of lzip, compatible with lzip 1.4 or newer. As
newer. As clzip is written in C, it may be easier to integrate in clzip is written in C, it may be easier to integrate in applications like
applications like package managers, embedded devices, or systems lacking a package managers, embedded devices, or systems lacking a C++ compiler.
C++ compiler.
Lzip is a lossless data compressor with a user interface similar to the one Lzip is a lossless data compressor with a user interface similar to the one
of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov
@ -131,11 +130,10 @@ been compressed. Decompressed is used to refer to data which have undergone
the process of decompression. the process of decompression.
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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.
The file Makefile.in is a data file used by configure to produce the The file Makefile.in is a data file used by configure to produce the Makefile.
Makefile. It has the same copyright owner and permissions that configure It has the same copyright owner and permissions that configure itself.
itself.

View file

@ -1,5 +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-2023 Antonio Diaz Diaz. Copyright (C) 2006-2024 Antonio Diaz Diaz.
This library is free software. Redistribution and use in source and This library is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided binary forms, with or without modification, are permitted provided

View file

@ -1,5 +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-2023 Antonio Diaz Diaz. Copyright (C) 2006-2024 Antonio Diaz Diaz.
This library is free software. Redistribution and use in source and This library is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided binary forms, with or without modification, are permitted provided

6
configure vendored
View file

@ -1,12 +1,12 @@
#! /bin/sh #! /bin/sh
# configure script for Clzip - LZMA lossless data compressor # configure script for Clzip - LZMA lossless data compressor
# Copyright (C) 2010-2023 Antonio Diaz Diaz. # Copyright (C) 2010-2024 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=clzip pkgname=clzip
pkgversion=1.14-rc1 pkgversion=1.14
progname=clzip progname=clzip
srctrigger=doc/${pkgname}.texi srctrigger=doc/${pkgname}.texi
@ -171,7 +171,7 @@ echo "MAKEINFO = ${MAKEINFO}"
rm -f Makefile rm -f Makefile
cat > Makefile << EOF cat > Makefile << EOF
# Makefile for Clzip - LZMA lossless data compressor # Makefile for Clzip - LZMA lossless data compressor
# Copyright (C) 2010-2023 Antonio Diaz Diaz. # Copyright (C) 2010-2024 Antonio Diaz Diaz.
# This file was generated automatically by configure. Don't edit. # This file was generated automatically by configure. Don't 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 - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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 - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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,15 +1,14 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
.TH CLZIP "1" "December 2023" "clzip 1.14-rc1" "User Commands" .TH CLZIP "1" "January 2024" "clzip 1.14" "User Commands"
.SH NAME .SH NAME
clzip \- reduces the size of files clzip \- reduces the size of files
.SH SYNOPSIS .SH SYNOPSIS
.B clzip .B clzip
[\fI\,options\/\fR] [\fI\,files\/\fR] [\fI\,options\/\fR] [\fI\,files\/\fR]
.SH DESCRIPTION .SH DESCRIPTION
Clzip is a C language version of lzip, fully compatible with lzip 1.4 or Clzip is a C language version of lzip, compatible with lzip 1.4 or newer. As
newer. As clzip is written in C, it may be easier to integrate in clzip is written in C, it may be easier to integrate in applications like
applications like package managers, embedded devices, or systems lacking a package managers, embedded devices, or systems lacking a C++ compiler.
C++ compiler.
.PP .PP
Lzip is a lossless data compressor with a user interface similar to the one Lzip is a lossless data compressor with a user interface similar to the one
of gzip or bzip2. Lzip uses a simplified form of the 'Lempel\-Ziv\-Markov of gzip or bzip2. Lzip uses a simplified form of the 'Lempel\-Ziv\-Markov
@ -123,7 +122,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 2023 Antonio Diaz Diaz. Copyright \(co 2024 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.

View file

@ -11,7 +11,7 @@ File: clzip.info, Node: Top, Next: Introduction, Up: (dir)
Clzip Manual Clzip Manual
************ ************
This manual is for Clzip (version 1.14-rc1, 20 December 2023). This manual is for Clzip (version 1.14, 22 January 2024).
* Menu: * Menu:
@ -29,7 +29,7 @@ This manual is for Clzip (version 1.14-rc1, 20 December 2023).
* Concept index:: Index of concepts * Concept index:: Index of concepts
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 Antonio Diaz Diaz.
This manual is free documentation: you have unlimited permission to copy, This manual is free documentation: you have unlimited permission to copy,
distribute, and modify it. distribute, and modify it.
@ -40,10 +40,9 @@ File: clzip.info, Node: Introduction, Next: Output, Prev: Top, Up: Top
1 Introduction 1 Introduction
************** **************
Clzip is a C language version of lzip, fully compatible with lzip 1.4 or Clzip is a C language version of lzip, compatible with lzip 1.4 or newer.
newer. As clzip is written in C, it may be easier to integrate in As clzip is written in C, it may be easier to integrate in applications like
applications like package managers, embedded devices, or systems lacking a package managers, embedded devices, or systems lacking a C++ compiler.
C++ compiler.
Lzip is a lossless data compressor with a user interface similar to the Lzip is a lossless data compressor with a user interface similar to the
one of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov one of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov
@ -464,14 +463,9 @@ method is far more difficult.
Lzip has been designed, written, and tested with great care to replace Lzip has been designed, written, and tested with great care to replace
gzip and bzip2 as the standard general-purpose compressed format for gzip and bzip2 as the standard general-purpose compressed format for
Unix-like systems. This chapter describes the lessons learned from these Unix-like systems. This chapter describes the lessons learned from these
previous formats, and their application to the design of lzip. previous formats, and their application to the design of lzip. The lzip
format specification has been reviewed carefully and is believed to be free
Lzip is developed by volunteers who lack the resources required for from design errors.
extensive testing in all circumstances. It is up to you to test lzip before
using it in mission-critical applications. However, a compressor like lzip
is not a toy, and maintaining it is not a hobby. Many people's data depend
on it. Therefore the lzip file format has been reviewed carefully and is
believed to be free from negligent design errors.
4.1 Format design 4.1 Format design
@ -1016,8 +1010,7 @@ decoded) and 'code' (representing the current point within 'range').
'range' is initialized to 2^32 - 1, and 'code' is initialized to 0. 'range' is initialized to 2^32 - 1, and 'code' is initialized to 0.
The range encoder produces a first 0 byte that must be ignored by the The range encoder produces a first 0 byte that must be ignored by the
range decoder. This is done by shifting 5 bytes in the initialization of range decoder. (See the 'Range_decoder' constructor in the source).
'code' instead of 4. (See the 'Range_decoder' constructor in the source).
7.4 Decoding and checking the LZMA stream 7.4 Decoding and checking the LZMA stream
@ -1197,7 +1190,7 @@ Appendix A Reference source code
******************************** ********************************
/* Lzd - Educational decompressor for the lzip format /* Lzd - Educational decompressor for the lzip format
Copyright (C) 2013-2023 Antonio Diaz Diaz. Copyright (C) 2013-2024 Antonio Diaz Diaz.
This program is free software. Redistribution and use in source and This program is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided binary forms, with or without modification, are permitted provided
@ -1368,9 +1361,9 @@ public:
return symbol; return symbol;
} }
unsigned decode_bit( Bit_model & bm ) bool decode_bit( Bit_model & bm )
{ {
unsigned symbol; bool symbol;
const uint32_t bound = ( range >> bit_model_total_bits ) * bm.probability; const uint32_t bound = ( range >> bit_model_total_bits ) * bm.probability;
if( code < bound ) if( code < bound )
{ {
@ -1416,8 +1409,8 @@ public:
unsigned symbol = 1; unsigned symbol = 1;
for( int i = 7; i >= 0; --i ) for( int i = 7; i >= 0; --i )
{ {
const unsigned match_bit = ( match_byte >> i ) & 1; const bool match_bit = ( match_byte >> i ) & 1;
const unsigned bit = decode_bit( bm[symbol+(match_bit<<8)+0x100] ); const bool bit = decode_bit( bm[symbol+(match_bit<<8)+0x100] );
symbol = ( symbol << 1 ) | bit; symbol = ( symbol << 1 ) | bit;
if( match_bit != bit ) if( match_bit != bit )
{ {
@ -1621,7 +1614,7 @@ int main( const int argc, const char * const argv[] )
"See the lzip manual for an explanation of the code.\n" "See the lzip manual for an explanation of the code.\n"
"\nUsage: %s [-d] < file.lz > file\n" "\nUsage: %s [-d] < file.lz > file\n"
"Lzd decompresses from standard input to standard output.\n" "Lzd decompresses from standard input to standard output.\n"
"\nCopyright (C) 2023 Antonio Diaz Diaz.\n" "\nCopyright (C) 2024 Antonio Diaz Diaz.\n"
"License 2-clause BSD.\n" "License 2-clause BSD.\n"
"This is free software: you are free to change and redistribute it.\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" "There is NO WARRANTY, to the extent permitted by law.\n"
@ -1714,22 +1707,22 @@ Concept index
 
Tag Table: Tag Table:
Node: Top205 Node: Top205
Node: Introduction1212 Node: Introduction1207
Node: Output7342 Node: Output7331
Node: Invoking clzip8945 Node: Invoking clzip8934
Ref: --trailing-error9823 Ref: --trailing-error9812
Node: Quality assurance19929 Node: Quality assurance19918
Node: Algorithm29060 Node: Algorithm28733
Node: File format32468 Node: File format32141
Ref: coded-dict-size33898 Ref: coded-dict-size33571
Node: Stream format35129 Node: Stream format34802
Ref: what-is-coded37525 Ref: what-is-coded37198
Node: Trailing data46478 Node: Trailing data46072
Node: Examples48816 Node: Examples48410
Ref: concat-example50266 Ref: concat-example49860
Node: Problems51496 Node: Problems51090
Node: Reference source code52032 Node: Reference source code51626
Node: Concept index67094 Node: Concept index66672
 
End Tag Table End Tag Table

View file

@ -6,8 +6,8 @@
@finalout @finalout
@c %**end of header @c %**end of header
@set UPDATED 20 December 2023 @set UPDATED 22 January 2024
@set VERSION 1.14-rc1 @set VERSION 1.14
@dircategory Compression @dircategory Compression
@direntry @direntry
@ -51,7 +51,7 @@ This manual is for Clzip (version @value{VERSION}, @value{UPDATED}).
@end menu @end menu
@sp 1 @sp 1
Copyright @copyright{} 2010-2023 Antonio Diaz Diaz. Copyright @copyright{} 2010-2024 Antonio Diaz Diaz.
This manual is free documentation: you have unlimited permission to copy, This manual is free documentation: you have unlimited permission to copy,
distribute, and modify it. distribute, and modify it.
@ -63,10 +63,9 @@ distribute, and modify it.
@cindex introduction @cindex introduction
@uref{http://www.nongnu.org/lzip/clzip.html,,Clzip} @uref{http://www.nongnu.org/lzip/clzip.html,,Clzip}
is a C language version of lzip, fully compatible with @w{lzip 1.4} or is a C language version of lzip, compatible with @w{lzip 1.4} or newer.
newer. As clzip is written in C, it may be easier to integrate in As clzip is written in C, it may be easier to integrate in applications like
applications like package managers, embedded devices, or systems lacking a package managers, embedded devices, or systems lacking a C++ compiler.
C++ compiler.
@uref{http://www.nongnu.org/lzip/lzip.html,,Lzip} @uref{http://www.nongnu.org/lzip/lzip.html,,Lzip}
is a lossless data compressor with a user interface similar to the one is a lossless data compressor with a user interface similar to the one
@ -516,14 +515,9 @@ method is far more difficult.@*
Lzip has been designed, written, and tested with great care to replace gzip Lzip has been designed, written, and tested with great care to replace gzip
and bzip2 as the standard general-purpose compressed format for Unix-like and bzip2 as the standard general-purpose compressed format for Unix-like
systems. This chapter describes the lessons learned from these previous systems. This chapter describes the lessons learned from these previous
formats, and their application to the design of lzip. formats, and their application to the design of lzip. The lzip format
specification has been reviewed carefully and is believed to be free from
Lzip is developed by volunteers who lack the resources required for design errors.
extensive testing in all circumstances. It is up to you to test lzip before
using it in mission-critical applications. However, a compressor like lzip
is not a toy, and maintaining it is not a hobby. Many people's data depend
on it. Therefore the lzip file format has been reviewed carefully and is
believed to be free from negligent design errors.
@sp 1 @sp 1
@section Format design @section Format design
@ -1092,9 +1086,7 @@ not yet decoded) and @samp{code} (representing the current point within
@samp{code} is initialized to 0. @samp{code} is initialized to 0.
The range encoder produces a first 0 byte that must be ignored by the The range encoder produces a first 0 byte that must be ignored by the
range decoder. This is done by shifting 5 bytes in the initialization of range decoder. (See the @samp{Range_decoder} constructor in the source).
@samp{code} instead of 4. (See the @samp{Range_decoder} constructor in
the source).
@sp 1 @sp 1
@section Decoding and checking the LZMA stream @section Decoding and checking the LZMA stream
@ -1315,7 +1307,7 @@ find by running @w{@samp{clzip --version}}.
@verbatim @verbatim
/* Lzd - Educational decompressor for the lzip format /* Lzd - Educational decompressor for the lzip format
Copyright (C) 2013-2023 Antonio Diaz Diaz. Copyright (C) 2013-2024 Antonio Diaz Diaz.
This program is free software. Redistribution and use in source and This program is free software. Redistribution and use in source and
binary forms, with or without modification, are permitted provided binary forms, with or without modification, are permitted provided
@ -1486,9 +1478,9 @@ public:
return symbol; return symbol;
} }
unsigned decode_bit( Bit_model & bm ) bool decode_bit( Bit_model & bm )
{ {
unsigned symbol; bool symbol;
const uint32_t bound = ( range >> bit_model_total_bits ) * bm.probability; const uint32_t bound = ( range >> bit_model_total_bits ) * bm.probability;
if( code < bound ) if( code < bound )
{ {
@ -1534,8 +1526,8 @@ public:
unsigned symbol = 1; unsigned symbol = 1;
for( int i = 7; i >= 0; --i ) for( int i = 7; i >= 0; --i )
{ {
const unsigned match_bit = ( match_byte >> i ) & 1; const bool match_bit = ( match_byte >> i ) & 1;
const unsigned bit = decode_bit( bm[symbol+(match_bit<<8)+0x100] ); const bool bit = decode_bit( bm[symbol+(match_bit<<8)+0x100] );
symbol = ( symbol << 1 ) | bit; symbol = ( symbol << 1 ) | bit;
if( match_bit != bit ) if( match_bit != bit )
{ {
@ -1739,7 +1731,7 @@ int main( const int argc, const char * const argv[] )
"See the lzip manual for an explanation of the code.\n" "See the lzip manual for an explanation of the code.\n"
"\nUsage: %s [-d] < file.lz > file\n" "\nUsage: %s [-d] < file.lz > file\n"
"Lzd decompresses from standard input to standard output.\n" "Lzd decompresses from standard input to standard output.\n"
"\nCopyright (C) 2023 Antonio Diaz Diaz.\n" "\nCopyright (C) 2024 Antonio Diaz Diaz.\n"
"License 2-clause BSD.\n" "License 2-clause BSD.\n"
"This is free software: you are free to change and redistribute it.\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" "There is NO WARRANTY, to the extent permitted by law.\n"

View file

@ -1,5 +1,5 @@
/* Clzip - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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 - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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 - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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 - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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 - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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 - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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

2
list.c
View file

@ -1,5 +1,5 @@
/* Clzip - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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

2
lzip.h
View file

@ -1,5 +1,5 @@
/* Clzip - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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 - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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 - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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

19
main.c
View file

@ -1,5 +1,5 @@
/* Clzip - LZMA lossless data compressor /* Clzip - LZMA lossless data compressor
Copyright (C) 2010-2023 Antonio Diaz Diaz. Copyright (C) 2010-2024 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
@ -80,7 +80,7 @@
int verbosity = 0; int verbosity = 0;
static const char * const program_name = "clzip"; static const char * const program_name = "clzip";
static const char * const program_year = "2023"; static const char * const program_year = "2024";
static const char * invocation_name = "clzip"; /* default value */ static const char * invocation_name = "clzip"; /* default value */
static const struct { const char * from; const char * to; } known_extensions[] = { static const struct { const char * from; const char * to; } known_extensions[] = {
@ -105,10 +105,9 @@ static bool delete_output_on_interrupt = false;
static void show_help( void ) static void show_help( void )
{ {
printf( "Clzip is a C language version of lzip, fully compatible with lzip 1.4 or\n" printf( "Clzip is a C language version of lzip, compatible with lzip 1.4 or newer. As\n"
"newer. As clzip is written in C, it may be easier to integrate in\n" "clzip is written in C, it may be easier to integrate in applications like\n"
"applications like package managers, embedded devices, or systems lacking a\n" "package managers, embedded devices, or systems lacking a C++ compiler.\n"
"C++ compiler.\n"
"\nLzip is a lossless data compressor with a user interface similar to the one\n" "\nLzip is a lossless data compressor with a user interface similar to the one\n"
"of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov\n" "of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov\n"
"chain-Algorithm' (LZMA) stream format to maximize interoperability. The\n" "chain-Algorithm' (LZMA) stream format to maximize interoperability. The\n"
@ -621,7 +620,7 @@ static void close_and_set_permissions( const struct stat * const in_statsp )
if( in_statsp ) if( in_statsp )
{ {
const mode_t mode = in_statsp->st_mode; const mode_t mode = in_statsp->st_mode;
/* fchown will in many cases return with EPERM, which can be safely ignored. */ /* fchown in many cases returns with EPERM, which can be safely ignored. */
if( fchown( outfd, in_statsp->st_uid, in_statsp->st_gid ) == 0 ) if( fchown( outfd, in_statsp->st_uid, in_statsp->st_gid ) == 0 )
{ if( fchmod( outfd, mode ) != 0 ) warning = true; } { if( fchmod( outfd, mode ) != 0 ) warning = true; }
else else
@ -1134,11 +1133,11 @@ int main( const int argc, const char * const argv[] )
int retval = 0; int retval = 0;
const bool one_to_one = !to_stdout && program_mode != m_test && !to_file; const bool one_to_one = !to_stdout && program_mode != m_test && !to_file;
bool stdin_used = false; bool stdin_used = false;
struct stat in_stats;
for( i = 0; i < num_filenames; ++i ) for( i = 0; i < num_filenames; ++i )
{ {
const char * input_filename = ""; const char * input_filename = "";
int infd; int infd;
struct stat in_stats;
Pp_set_name( &pp, filenames[i] ); Pp_set_name( &pp, filenames[i] );
if( strcmp( filenames[i], "-" ) == 0 ) if( strcmp( filenames[i], "-" ) == 0 )
@ -1205,7 +1204,9 @@ int main( const int argc, const char * const argv[] )
( program_mode != m_compress || volume_size == 0 ) ) ( program_mode != m_compress || volume_size == 0 ) )
remove( input_filename ); remove( input_filename );
} }
if( delete_output_on_interrupt ) close_and_set_permissions( 0 ); /* -o */ if( delete_output_on_interrupt ) /* -o */
close_and_set_permissions( ( retval == 0 && !stdin_used &&
filenames_given && num_filenames == 1 ) ? &in_stats : 0 );
else if( outfd >= 0 && close( outfd ) != 0 ) /* -c */ else if( outfd >= 0 && close( outfd ) != 0 ) /* -c */
{ {
show_error( "Error closing stdout", errno, false ); show_error( "Error closing stdout", errno, false );

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# check script for Clzip - LZMA lossless data compressor # check script for Clzip - LZMA lossless data compressor
# Copyright (C) 2010-2023 Antonio Diaz Diaz. # Copyright (C) 2010-2024 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.