Add lrzcat symlink which automatically decompresses to stdout.

Revert automatic compression/decompression to stdout when not outputting to a tty, to be consistent with gzip.
This commit is contained in:
Con Kolivas 2011-05-07 13:22:35 +10:00
parent d80f220c72
commit d033743e6f
10 changed files with 145 additions and 25 deletions

View file

@ -1,4 +1,9 @@
lrzip ChangeLog
MAY 2011, Con Kolivas
* Addition of explicit lrzcat symlink which automatically sets "-d -o -"
* Revert automatic output to stdout due to addition of explicit lrzcat
executable, and to be consistent with gzip.
APRIL 2011, version 0.604 Con Kolivas
* Detach threads after creating them on the compression side. Not joining them
meant that compressing massive files requiring hundreds of threads would

View file

@ -76,9 +76,11 @@ EXTRA_DIST = \
install-exec-hook:
$(LN_S) -f lrzip$(EXEEXT) $(DESTDIR)@bindir@/lrunzip$(EXEEXT)
$(LN_S) -f lrzip$(EXEEXT) $(DESTDIR)@bindir@/lrzcat$(EXEEXT)
$(LN_S) -f lrztar$(EXEEXT) $(DESTDIR)@bindir@/lrzuntar$(EXEEXT)
uninstall-local:
rm -f @bindir@/lrunzip
rm -f @bindir@/lrzcat
rm -f @bindir@/lrzuntar

View file

@ -1,3 +1,7 @@
Addition of lrzcat - automatically decompresses .lrz files to stdout.
lrzip and lrunzip will no longer automatically output to stdout due to
addition of lrzcat executable, and to be consistent with gzip.
lrzip-0.604
lrzip will no longer fail with a "resource temporarily unavailable" error

11
main.c
View file

@ -505,6 +505,8 @@ int main(int argc, char *argv[])
if (strstr(argv[0], "lrunzip"))
control.flags |= FLAG_DECOMPRESS;
else if (strstr(argv[0], "lrzcat"))
control.flags |= FLAG_DECOMPRESS | FLAG_STDOUT;
control.compression_level = 7;
control.ramsize = get_ram();
@ -610,12 +612,16 @@ int main(int argc, char *argv[])
case 'o':
if (control.outdir)
failure("Cannot have -o and -O together\n");
if (unlikely(STDOUT))
failure("Cannot specify an output filename when outputting to stdout\n");
control.outname = optarg;
control.suffix = "";
break;
case 'O':
if (control.outname) /* can't mix -o and -O */
failure("Cannot have options -o and -O together\n");
if (unlikely(STDOUT))
failure("Cannot specify an output directory when outputting to stdout\n");
control.outdir = malloc(strlen(optarg) + 2);
if (control.outdir == NULL)
fatal("Failed to allocate for outdir\n");
@ -634,6 +640,8 @@ int main(int argc, char *argv[])
case 'S':
if (control.outname)
failure("Specified output filename already, can't specify an extension.\n");
if (unlikely(STDOUT))
failure("Cannot specify a filename suffix when outputting to stdout\n");
control.suffix = optarg;
break;
case 't':
@ -747,9 +755,8 @@ int main(int argc, char *argv[])
}
/* If no output filename is specified, and we're using stdin,
* or we detect that stdout is not going to the terminal,
* use stdout */
if (!control.outname && (STDIN || !isatty(fileno((FILE *)stdout)))) {
if (!control.outname && STDIN) {
control.flags |= FLAG_STDOUT;
control.msgout = stderr;
register_outputfile(control.msgout);

View file

@ -1,16 +1,19 @@
MAINTAINERCLEANFILES = Makefile.in lrunzip.1 lrztar.1 lrzuntar.1
man1_MANS = lrzip.1 lrunzip.1 lrztar.1 lrzuntar.1
man1_MANS = lrzip.1 lrunzip.1 lrzcat.1 lrztar.1 lrzuntar.1
man5_MANS = lrzip.conf.5
BUILT_SOURCES = lrunzip.1 lrztar.1 lrzuntar.1
BUILT_SOURCES = lrunzip.1 lrzcat.1 lrztar.1 lrzuntar.1
CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = lrzip.1 lrunzip.1.pod lrztar.1.pod lrzuntar.1.pod $(man5_MANS)
EXTRA_DIST = lrzip.1 lrunzip.1.pod lrzcat.1.pod lrztar.1.pod lrzuntar.1.pod $(man5_MANS)
lrunzip.1: lrunzip.1.pod
pod2man $< $@
lrzcat.1: lrzcat.1.pod
pod2man $< $@
lrztar.1: lrztar.1.pod
pod2man $< $@

View file

@ -1,6 +1,6 @@
# Copyright
#
# Copyright (C) 2010 Con Kolivas
# Copyright (C) 2010-2011 Con Kolivas
# Copyright (C) 2009-2009 Jari Aalto
#
# License
@ -65,21 +65,23 @@ None.
=head1 SEE ALSO
lrzip.conf(5),
lrzip(1),
lrzcat(1),
lrztar(1),
lrzuntar(1),
bzip2(1),
gzip(1),
lzop(1),
lrzip(1),
rzip(1),
zip(1)
lrztar(1),
lrzip.conf(5)
=head1 AUTHORS
Program was written by Con Kolivas.
This manual page was written by Jari Aalto <jari.aalto@cante.net> (but
may be used by others). Released under license GNU GPL version 2or (at
may be used by others). Released under license GNU GPL version 2 or (at
your option) any later version. For more information about license,
visit <http://www.gnu.org/copyleft/gpl.html>.

85
man/lrzcat.1.pod Normal file
View file

@ -0,0 +1,85 @@
# Copyright
#
# Copyright (C) 2011 Con Kolivas
#
# License
#
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Description
#
# To learn what TOP LEVEL section to use in manual pages,
# see POSIX/Susv standard and "tility Description Defaults" at
# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11
#
# This is manual page in Perl POD format. Read more at
# http://perldoc.perl.org/perlpod.html or run command:
#
# perldoc perlpod | less
#
# To check the syntax:
#
# podchecker *.pod
#
# Create manual page with command:
#
# pod2man PAGE.N.pod > PAGE.N
=pod
=head1 NAME
lrzcat - Uncompress LRZ files to STDOUT
=head1 SYNOPSIS
lrzcat [options] FILE [... FILE]
=head1 DESCRIPTION
lrzcat is identical to C<lrzip -d -o -> used to decompress files to STDOUT.
=head1 OPTIONS
See lrzip(1).
=head1 ENVIRONMENT
None.
=head1 FILES
None.
=head1 SEE ALSO
lrzip.conf(5),
lrzip(1),
lrunzip(1),
lrztar(1),
lrzuntar(1),
bzip2(1),
gzip(1),
lzop(1),
rzip(1),
zip(1)
=head1 AUTHORS
This manual page was written by Con Kolivas <kernel@kolivas.org> (but
may be used by others). Released under license GNU GPL version 2 or (at
your option) any later version. For more information about license,
visit <http://www.gnu.org/copyleft/gpl.html>.
=cut

View file

@ -1,4 +1,4 @@
.TH "lrzip" "1" "February 2011" "" ""
.TH "lrzip" "1" "May 2011" "" ""
.SH "NAME"
lrzip \- a large-file compression program
.SH "SYNOPSIS"
@ -9,6 +9,8 @@ lrzip \-d [OPTIONS] <file>
.br
lrunzip [OPTIONS] <file>
.br
lrzcat [OPTIONS] <file>
.br
lrztar [lrzip options] <directory>
.br
lrztar \-d [lrzip options] <directory>
@ -91,7 +93,8 @@ written is the same as the original archived.
.IP "\fB-d\fP"
Decompress. If this option is not used then lrzip looks at
the name used to launch the program. If it contains the string
"lrunzip" then the \-d option is automatically set.
"lrunzip" then the \-d option is automatically set. If it contains the string
"lrzcat" then the \-d \-o \- options are automatically set.
.IP
.IP "\fB-e\fP"
Encrypt. This option enables high grade password encryption using a combination
@ -322,14 +325,15 @@ Nil known.
.PP
.SH "SEE ALSO"
lrzip.conf(5),
lrunzip(1),
lrzcat(1),
lrztar(1),
lrzuntar(1),
bzip2(1),
gzip(1),
lzop(1),
lrzip(1),
rzip(1),
zip(1)
lrztar(1),
lrzuntar(1)
.PP
.SH "AUTHOR and CREDITS"

View file

@ -1,6 +1,6 @@
# Copyright
#
# Copyright (C) 2010 Con Kolivas
# Copyright (C) 2010-2011 Con Kolivas
# Copyright (C) 2009-2010 Jari Aalto
#
# License
@ -69,20 +69,23 @@ None.
=head1 SEE ALSO
lrzip.conf(5),
lrzuntar(1),
lrzip(1),
lrunzip(1),
lrzcat(1),
bzip2(1),
gzip(1),
lzop(1),
lrzip(1),
rzip(1),
zip(1),
lrzip.conf(5)
zip(1)
=head1 AUTHORS
Program was written by Con Kolivas.
This manual page was written by Jari Aalto <jari.aalto@cante.net> (but
may be used by others). Released under license GNU GPL version 2or (at
may be used by others). Released under license GNU GPL version 2 or (at
your option) any later version. For more information about license,
visit <http://www.gnu.org/copyleft/gpl.html>.

View file

@ -1,6 +1,6 @@
# Copyright
#
# Copyright (C) 2010 Con Kolivas
# Copyright (C) 2010-2011 Con Kolivas
#
# License
#
@ -47,17 +47,22 @@ None.
=head1 SEE ALSO
lrzip.conf(5),
lrztar(1),
lrzip(1),
lrunzip(1),
lrzcat(1),
bzip2(1),
gzip(1),
lzop(1),
lrzip(1),
rzip(1),
zip(1),
lrzip.conf(5)
zip(1)
=head1 AUTHORS
Con Kolivas.
This manual page was written by Con Kolivas <kernel@kolivas.org> (but
may be used by others). Released under license GNU GPL version 2 or (at
your option) any later version. For more information about license,
visit <http://www.gnu.org/copyleft/gpl.html>.
=cut