mirror of
https://github.com/ckolivas/lrzip.git
synced 2026-01-04 23:50:02 +01:00
Merge branch 'compat'
This commit is contained in:
commit
2086185ed5
|
|
@ -107,12 +107,14 @@ 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)
|
||||
$(LN_S) -f lrzip$(EXEEXT) $(DESTDIR)$(bindir)/lrz$(EXEEXT)
|
||||
|
||||
|
||||
uninstall-local:
|
||||
rm -f $(bindir)/lrunzip
|
||||
rm -f $(bindir)/lrzcat
|
||||
rm -f $(bindir)/lrzuntar
|
||||
rm -f $(bindir)/lrz
|
||||
|
||||
.PHONY: doc
|
||||
|
||||
|
|
|
|||
89
lrzip.c
89
lrzip.c
|
|
@ -311,8 +311,8 @@ int open_tmpoutfile(rzip_control *control)
|
|||
|
||||
fd_out = mkstemp(control->outfile);
|
||||
if (fd_out == -1) {
|
||||
print_verbose("WARNING: Failed to create out tmpfile: %s , will fail if cannot perform entirely in ram\n",
|
||||
control->outfile, DECOMPRESS ? "de" : "");
|
||||
print_progress("WARNING: Failed to create out tmpfile: %s, will fail if cannot perform %scompression entirely in ram\n",
|
||||
control->outfile, DECOMPRESS ? "de" : "");
|
||||
} else
|
||||
register_outfile(control, control->outfile, TEST_ONLY || STDOUT || !KEEP_BROKEN);
|
||||
return fd_out;
|
||||
|
|
@ -424,31 +424,50 @@ bool write_fdin(rzip_control *control)
|
|||
/* Open a temporary inputfile to perform stdin decompression */
|
||||
int open_tmpinfile(rzip_control *control)
|
||||
{
|
||||
int fd_in;
|
||||
int fd_in = -1;
|
||||
|
||||
/* Use temporary directory if there is one */
|
||||
if (control->tmpdir) {
|
||||
control->infile = malloc(strlen(control->tmpdir) + 15);
|
||||
if (unlikely(!control->infile))
|
||||
fatal_return(("Failed to allocate infile name\n"), -1);
|
||||
strcpy(control->infile, control->tmpdir);
|
||||
strcat(control->infile, "lrzipin.XXXXXX");
|
||||
} else {
|
||||
control->infile = malloc(15);
|
||||
fd_in = mkstemp(control->infile);
|
||||
}
|
||||
|
||||
/* Try the current directory */
|
||||
if (fd_in == -1) {
|
||||
free(control->infile);
|
||||
control->infile = malloc(16);
|
||||
if (unlikely(!control->infile))
|
||||
fatal_return(("Failed to allocate infile name\n"), -1);
|
||||
strcpy(control->infile, "lrzipin.XXXXXX");
|
||||
fd_in = mkstemp(control->infile);
|
||||
}
|
||||
|
||||
fd_in = mkstemp(control->infile);
|
||||
if (unlikely(fd_in == -1))
|
||||
fatal_return(("Failed to create in tmpfile: %s\n", control->infile), -1);
|
||||
register_infile(control, control->infile, (DECOMPRESS || TEST_ONLY) && STDIN);
|
||||
/* Unlink temporary file immediately to minimise chance of files left
|
||||
* lying around in cases of failure_return((. */
|
||||
if (unlikely(unlink(control->infile))) {
|
||||
fatal("Failed to unlink tmpfile: %s\n", control->infile);
|
||||
close(fd_in);
|
||||
return -1;
|
||||
/* Use /tmp if nothing is writeable so far */
|
||||
if (fd_in == -1) {
|
||||
free(control->infile);
|
||||
control->infile = malloc(20);
|
||||
if (unlikely(!control->infile))
|
||||
fatal_return(("Failed to allocate infile name\n"), -1);
|
||||
strcpy(control->infile, "/tmp/lrzipin.XXXXXX");
|
||||
fd_in = mkstemp(control->infile);
|
||||
}
|
||||
|
||||
if (fd_in == -1) {
|
||||
print_progress("WARNING: Failed to create in tmpfile: %s, will fail if cannot perform %scompression entirely in ram\n",
|
||||
control->infile, DECOMPRESS ? "de" : "");
|
||||
} else {
|
||||
register_infile(control, control->infile, (DECOMPRESS || TEST_ONLY) && STDIN);
|
||||
/* Unlink temporary file immediately to minimise chance of files left
|
||||
* lying around in cases of failure_return((. */
|
||||
if (unlikely(unlink(control->infile))) {
|
||||
fatal("Failed to unlink tmpfile: %s\n", control->infile);
|
||||
close(fd_in);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return fd_in;
|
||||
}
|
||||
|
|
@ -474,6 +493,8 @@ bool read_tmpinfile(rzip_control *control, int fd_in)
|
|||
FILE *tmpinfp;
|
||||
int tmpchar;
|
||||
|
||||
if (fd_in == -1)
|
||||
return false;
|
||||
if (control->flags & FLAG_SHOW_PROGRESS)
|
||||
fprintf(control->msgout, "Copying from stdin.\n");
|
||||
tmpinfp = fdopen(fd_in, "w+");
|
||||
|
|
@ -715,8 +736,6 @@ bool decompress_file(rzip_control *control)
|
|||
|
||||
if (STDIN) {
|
||||
fd_in = open_tmpinfile(control);
|
||||
if (unlikely(fd_in == -1))
|
||||
return false;
|
||||
read_tmpinmagic(control);
|
||||
if (ENCRYPT)
|
||||
failure_return(("Cannot decompress encrypted file from STDIN\n"), false);
|
||||
|
|
@ -769,9 +788,10 @@ bool decompress_file(rzip_control *control)
|
|||
if (unlikely(!open_tmpoutbuf(control)))
|
||||
return false;
|
||||
|
||||
if (!STDIN)
|
||||
if (!STDIN) {
|
||||
if (unlikely(!read_magic(control, fd_in, &expected_size)))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!STDOUT && !TEST_ONLY) {
|
||||
/* Check if there's enough free space on the device chosen to fit the
|
||||
|
|
@ -814,7 +834,7 @@ bool decompress_file(rzip_control *control)
|
|||
/* if we get here, no fatal_return(( errors during decompression */
|
||||
print_progress("\r");
|
||||
if (!(STDOUT | TEST_ONLY))
|
||||
print_output("Output filename is: %s: ", control->outfile);
|
||||
print_progress("Output filename is: %s: ", control->outfile);
|
||||
if (!expected_size)
|
||||
expected_size = control->st_size;
|
||||
if (!ENCRYPT)
|
||||
|
|
@ -832,7 +852,7 @@ bool decompress_file(rzip_control *control)
|
|||
|
||||
close(fd_in);
|
||||
|
||||
if (!KEEP_FILES) {
|
||||
if (!KEEP_FILES && !STDIN) {
|
||||
if (unlikely(unlink(control->infile)))
|
||||
fatal_return(("Failed to unlink %s\n", infilecopy), false);
|
||||
}
|
||||
|
|
@ -941,7 +961,8 @@ bool get_fileinfo(rzip_control *control)
|
|||
infile_size = st.st_size;
|
||||
|
||||
/* Get decompressed size */
|
||||
if (unlikely(!read_magic(control, fd_in, &expected_size))) goto error;
|
||||
if (unlikely(!read_magic(control, fd_in, &expected_size)))
|
||||
goto error;
|
||||
|
||||
if (ENCRYPT) {
|
||||
print_output("Encrypted lrzip archive. No further information available\n");
|
||||
|
|
@ -1201,10 +1222,14 @@ bool compress_file(rzip_control *control)
|
|||
fatal_goto(("Failed to create %s\n", control->outfile), error);
|
||||
}
|
||||
control->fd_out = fd_out;
|
||||
if (!STDIN)
|
||||
if (unlikely(!preserve_perms(control, fd_in, fd_out))) goto error;
|
||||
} else
|
||||
if (unlikely(!open_tmpoutbuf(control))) goto error;
|
||||
if (!STDIN) {
|
||||
if (unlikely(!preserve_perms(control, fd_in, fd_out)))
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
if (unlikely(!open_tmpoutbuf(control)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Write zeroes to header at beginning of file */
|
||||
if (unlikely(!STDOUT && write(fd_out, header, sizeof(header)) != sizeof(header)))
|
||||
|
|
@ -1213,8 +1238,10 @@ bool compress_file(rzip_control *control)
|
|||
rzip_fd(control, fd_in, fd_out);
|
||||
|
||||
/* Wwrite magic at end b/c lzma does not tell us properties until it is done */
|
||||
if (!STDOUT)
|
||||
if (unlikely(!write_magic(control))) goto error;
|
||||
if (!STDOUT) {
|
||||
if (unlikely(!write_magic(control)))
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (ENCRYPT)
|
||||
release_hashes(control);
|
||||
|
|
@ -1229,7 +1256,7 @@ bool compress_file(rzip_control *control)
|
|||
if (TMP_OUTBUF)
|
||||
close_tmpoutbuf(control);
|
||||
|
||||
if (!KEEP_FILES) {
|
||||
if (!KEEP_FILES && !STDIN) {
|
||||
if (unlikely(unlink(control->infile)))
|
||||
fatal_return(("Failed to unlink %s\n", control->infile), false);
|
||||
}
|
||||
|
|
@ -1288,13 +1315,13 @@ bool initialise_control(rzip_control *control)
|
|||
}
|
||||
size_t len = strlen(eptr);
|
||||
|
||||
control->tmpdir = malloc(len+2);
|
||||
control->tmpdir = malloc(len + 2);
|
||||
if (control->tmpdir == NULL)
|
||||
fatal_return(("Failed to allocate for tmpdir\n"), false);
|
||||
strcpy(control->tmpdir, eptr);
|
||||
if (control->tmpdir[len-1] != '/') {
|
||||
if (control->tmpdir[len - 1] != '/') {
|
||||
control->tmpdir[len] = '/'; /* need a trailing slash */
|
||||
control->tmpdir[len+1] = '\0';
|
||||
control->tmpdir[len + 1] = '\0';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
134
main.c
134
main.c
|
|
@ -50,6 +50,7 @@
|
|||
#endif
|
||||
|
||||
#include <getopt.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#include "rzip.h"
|
||||
#include "lrzip_core.h"
|
||||
|
|
@ -61,28 +62,39 @@
|
|||
|
||||
static rzip_control base_control, local_control, *control;
|
||||
|
||||
static void usage(void)
|
||||
static void usage(bool compat)
|
||||
{
|
||||
print_output("lrzip version %s\n", PACKAGE_VERSION);
|
||||
print_output("lrz%s version %s\n", compat ? "" : "ip", PACKAGE_VERSION);
|
||||
print_output("Copyright (C) Con Kolivas 2006-2015\n");
|
||||
print_output("Based on rzip ");
|
||||
print_output("Copyright (C) Andrew Tridgell 1998-2003\n\n");
|
||||
print_output("Usage: lrzip [options] <file...>\n");
|
||||
print_output("Usage: lrz%s [options] <file...>\n", compat ? "" : "ip");
|
||||
print_output("General options:\n");
|
||||
print_output(" -c, --check check integrity of file written on decompression\n");
|
||||
if (compat) {
|
||||
print_output(" -c, --stdout output to STDOUT\n");
|
||||
print_output(" -C, --check check integrity of file written on decompression\n");
|
||||
} else
|
||||
print_output(" -c, -C, --check check integrity of file written on decompression\n");
|
||||
print_output(" -d, --decompress decompress\n");
|
||||
print_output(" -e, --encrypt password protected sha512/aes128 encryption on compression\n");
|
||||
print_output(" -h, -?, --help show help\n");
|
||||
print_output(" -H, --hash display md5 hash integrity information\n");
|
||||
print_output(" -i, --info show compressed file information\n");
|
||||
print_output(" -q, --quiet don't show compression progress\n");
|
||||
if (compat) {
|
||||
print_output(" -L, --license display software version and license\n");
|
||||
print_output(" -P, --progress show compression progress\n");
|
||||
} else
|
||||
print_output(" -q, --quiet don't show compression progress\n");
|
||||
print_output(" -t, --test test compressed file integrity\n");
|
||||
print_output(" -v[v], --verbose Increase verbosity\n");
|
||||
print_output(" -v[v%s], --verbose Increase verbosity\n", compat ? "v" : "");
|
||||
print_output(" -V, --version show version\n");
|
||||
print_output("Options affecting output:\n");
|
||||
print_output(" -D, --delete delete existing files\n");
|
||||
if (!compat)
|
||||
print_output(" -D, --delete delete existing files\n");
|
||||
print_output(" -f, --force force overwrite of any existing files\n");
|
||||
print_output(" -k, --keep-broken keep broken or damaged output files\n");
|
||||
if (compat)
|
||||
print_output(" -k, --keep don't delete source files on de/compression\n");
|
||||
print_output(" -%s, --keep-broken keep broken or damaged output files\n", compat ? "K" : "k, -K");
|
||||
print_output(" -o, --outfile filename specify the output file name and/or path\n");
|
||||
print_output(" -O, --outdir directory specify the output directory when -o is not used\n");
|
||||
print_output(" -S, --suffix suffix specify compressed suffix (default '.lrz')\n");
|
||||
|
|
@ -93,8 +105,13 @@ static void usage(void)
|
|||
print_output(" -n, --no-compress no backend compression - prepare for other compressor\n");
|
||||
print_output(" -z, --zpaq zpaq compression (best, extreme compression, extremely slow)\n");
|
||||
print_output("Low level options:\n");
|
||||
if (compat) {
|
||||
print_output(" -1 .. -9 set lzma/bzip2/gzip compression level (1-9, default 7)\n");
|
||||
print_output(" --fast alias for -1\n");
|
||||
print_output(" --best alias for -9\n");
|
||||
}
|
||||
print_output(" -L, --level level set lzma/bzip2/gzip compression level (1-9, default 7)\n");
|
||||
print_output(" -N, --nice-level value Set nice value to value (default 19)\n");
|
||||
print_output(" -N, --nice-level value Set nice value to value (default %d)\n", compat ? 0 : 19);
|
||||
print_output(" -p, --threads value Set processor count to override number of threads\n");
|
||||
print_output(" -m, --maxram size Set maximim available ram in hundreds of MB\n");
|
||||
print_output(" overrides detected ammount of available ram\n");
|
||||
|
|
@ -189,57 +206,79 @@ static void show_summary(void)
|
|||
}
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"bzip2", no_argument, 0, 'b'},
|
||||
{"bzip2", no_argument, 0, 'b'}, /* 0 */
|
||||
{"check", no_argument, 0, 'c'},
|
||||
{"check", no_argument, 0, 'C'},
|
||||
{"decompress", no_argument, 0, 'd'},
|
||||
{"delete", no_argument, 0, 'D'},
|
||||
{"encrypt", no_argument, 0, 'e'},
|
||||
{"encrypt", no_argument, 0, 'e'}, /* 5 */
|
||||
{"force", no_argument, 0, 'f'},
|
||||
{"gzip", no_argument, 0, 'g'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"hash", no_argument, 0, 'H'},
|
||||
{"info", no_argument, 0, 'i'},
|
||||
{"info", no_argument, 0, 'i'}, /* 10 */
|
||||
{"keep-broken", no_argument, 0, 'k'},
|
||||
{"keep-broken", no_argument, 0, 'K'},
|
||||
{"lzo", no_argument, 0, 'l'},
|
||||
{"level", no_argument, 0, 'L'},
|
||||
{"maxram", required_argument, 0, 'm'},
|
||||
{"level", required_argument, 0, 'L'},
|
||||
{"maxram", required_argument, 0, 'm'}, /* 15 */
|
||||
{"no-compress", no_argument, 0, 'n'},
|
||||
{"nice-level", required_argument, 0, 'N'},
|
||||
{"outfile", required_argument, 0, 'o'},
|
||||
{"outdir", required_argument, 0, 'O'},
|
||||
{"threads", required_argument, 0, 'p'},
|
||||
{"threads", required_argument, 0, 'p'}, /* 20 */
|
||||
{"progress", no_argument, 0, 'P'},
|
||||
{"quiet", no_argument, 0, 'q'},
|
||||
{"suffix", required_argument, 0, 'S'},
|
||||
{"test", no_argument, 0, 't'},
|
||||
{"threshold", required_argument, 0, 'T'},
|
||||
{"threshold", required_argument, 0, 'T'}, /* 25 */
|
||||
{"unlimited", no_argument, 0, 'U'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"window", required_argument, 0, 'w'},
|
||||
{"zpaq", no_argument, 0, 'z'},
|
||||
{"zpaq", no_argument, 0, 'z'}, /* 30 */
|
||||
{"fast", no_argument, 0, '1'},
|
||||
{"best", no_argument, 0, '9'},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static void set_stdout(struct rzip_control *control)
|
||||
{
|
||||
control->flags |= FLAG_STDOUT;
|
||||
control->outFILE = stdout;
|
||||
control->msgout = stderr;
|
||||
register_outputfile(control, control->msgout);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
bool lrzcat = false, compat = false;
|
||||
struct timeval start_time, end_time;
|
||||
struct sigaction handler;
|
||||
double seconds,total_time; // for timers
|
||||
bool lrzcat = false;
|
||||
int c, i;
|
||||
int hours,minutes;
|
||||
extern int optind;
|
||||
char *eptr; /* for environment */
|
||||
char *eptr, *av; /* for environment */
|
||||
|
||||
control = &base_control;
|
||||
|
||||
initialise_control(control);
|
||||
|
||||
if (strstr(argv[0], "lrunzip"))
|
||||
av = basename(argv[0]);
|
||||
if (!strcmp(av, "lrunzip"))
|
||||
control->flags |= FLAG_DECOMPRESS;
|
||||
else if (strstr(argv[0], "lrzcat")) {
|
||||
else if (!strcmp(av, "lrzcat")) {
|
||||
control->flags |= FLAG_DECOMPRESS | FLAG_STDOUT;
|
||||
lrzcat = true;
|
||||
} else if (!strcmp(av, "lrz")) {
|
||||
/* Called in gzip compatible command line mode */
|
||||
control->flags &= ~FLAG_SHOW_PROGRESS;
|
||||
control->nice_val = 0;
|
||||
control->flags &= ~FLAG_KEEP_FILES;
|
||||
compat = true;
|
||||
long_options[1].name = "stdout";
|
||||
long_options[11].name = "keep";
|
||||
}
|
||||
|
||||
/* generate crc table */
|
||||
|
|
@ -255,7 +294,7 @@ int main(int argc, char *argv[])
|
|||
else if (!strstr(eptr,"NOCONFIG"))
|
||||
read_config(control);
|
||||
|
||||
while ((c = getopt_long(argc, argv, "bcdDefghHiklL:nN:o:O:p:qS:tTUm:vVw:z?", long_options, &i)) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "bcCdDefghHikKlL:nN:o:O:pPqS:tTUm:vVw:z?123456789", long_options, &i)) != -1) {
|
||||
switch (c) {
|
||||
case 'b':
|
||||
if (control->flags & FLAG_NOT_LZMA)
|
||||
|
|
@ -263,6 +302,12 @@ int main(int argc, char *argv[])
|
|||
control->flags |= FLAG_BZIP2_COMPRESS;
|
||||
break;
|
||||
case 'c':
|
||||
if (compat) {
|
||||
control->flags |= FLAG_KEEP_FILES;
|
||||
set_stdout(control);
|
||||
break;
|
||||
}
|
||||
case 'C':
|
||||
control->flags |= FLAG_CHECK;
|
||||
control->flags |= FLAG_HASH;
|
||||
break;
|
||||
|
|
@ -285,7 +330,7 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
usage();
|
||||
usage(compat);
|
||||
return -1;
|
||||
case 'H':
|
||||
control->flags |= FLAG_HASH;
|
||||
|
|
@ -294,6 +339,11 @@ int main(int argc, char *argv[])
|
|||
control->flags |= FLAG_INFO;
|
||||
break;
|
||||
case 'k':
|
||||
if (compat) {
|
||||
control->flags |= FLAG_KEEP_FILES;
|
||||
break;
|
||||
}
|
||||
case 'K':
|
||||
control->flags |= FLAG_KEEP_BROKEN;
|
||||
break;
|
||||
case 'l':
|
||||
|
|
@ -344,6 +394,9 @@ int main(int argc, char *argv[])
|
|||
if (control->threads < 1)
|
||||
failure("Must have at least one thread\n");
|
||||
break;
|
||||
case 'P':
|
||||
control->flags |= FLAG_SHOW_PROGRESS;
|
||||
break;
|
||||
case 'q':
|
||||
control->flags &= ~FLAG_SHOW_PROGRESS;
|
||||
break;
|
||||
|
|
@ -357,6 +410,8 @@ int main(int argc, char *argv[])
|
|||
case 't':
|
||||
if (control->outname)
|
||||
failure("Cannot specify an output file name when just testing.\n");
|
||||
if (compat)
|
||||
control->flags |= FLAG_KEEP_FILES;
|
||||
if (!KEEP_FILES)
|
||||
failure("Doubt that you want to delete a file when just testing.\n");
|
||||
control->flags |= FLAG_TEST_ONLY;
|
||||
|
|
@ -369,7 +424,9 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
case 'v':
|
||||
/* set verbosity flag */
|
||||
if (!(control->flags & FLAG_VERBOSITY) && !(control->flags & FLAG_VERBOSITY_MAX))
|
||||
if (!(control->flags & FLAG_SHOW_PROGRESS))
|
||||
control->flags |= FLAG_SHOW_PROGRESS;
|
||||
else if (!(control->flags & FLAG_VERBOSITY) && !(control->flags & FLAG_VERBOSITY_MAX))
|
||||
control->flags |= FLAG_VERBOSITY;
|
||||
else if ((control->flags & FLAG_VERBOSITY)) {
|
||||
control->flags &= ~FLAG_VERBOSITY;
|
||||
|
|
@ -388,6 +445,17 @@ int main(int argc, char *argv[])
|
|||
failure("Can only use one of -l, -b, -g, -z or -n\n");
|
||||
control->flags |= FLAG_ZPAQ_COMPRESS;
|
||||
break;
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
control->compression_level = c - '0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -449,15 +517,11 @@ int main(int argc, char *argv[])
|
|||
if (INFO && STDIN)
|
||||
failure("Will not get file info from STDIN\n");
|
||||
|
||||
/* If no output filename is specified, and we're using
|
||||
* stdin, use stdout */
|
||||
if ((control->outname && (strcmp(control->outname, "-") == 0)) ||
|
||||
/* If no output filename is specified, and we're using
|
||||
* stdin, use stdout */
|
||||
(!control->outname && STDIN) || lrzcat ) {
|
||||
control->flags |= FLAG_STDOUT;
|
||||
control->outFILE = stdout;
|
||||
control->msgout = stderr;
|
||||
register_outputfile(control, control->msgout);
|
||||
}
|
||||
(!control->outname && STDIN) || lrzcat)
|
||||
set_stdout(control);
|
||||
|
||||
if (lrzcat) {
|
||||
control->msgout = stderr;
|
||||
|
|
@ -482,12 +546,12 @@ int main(int argc, char *argv[])
|
|||
if (!FORCE_REPLACE) {
|
||||
if (STDIN && isatty(fileno((FILE *)stdin))) {
|
||||
print_err("Will not read stdin from a terminal. Use -f to override.\n");
|
||||
usage();
|
||||
usage(compat);
|
||||
exit (1);
|
||||
}
|
||||
if (!TEST_ONLY && STDOUT && isatty(fileno((FILE *)stdout))) {
|
||||
if (!TEST_ONLY && STDOUT && isatty(fileno((FILE *)stdout)) && !compat) {
|
||||
print_err("Will not write stdout to a terminal. Use -f to override.\n");
|
||||
usage();
|
||||
usage(compat);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in lrunzip.1 lrztar.1 lrzuntar.1
|
||||
MAINTAINERCLEANFILES = Makefile.in lrunzip.1 lrztar.1 lrzuntar.1 lrz.1
|
||||
|
||||
man1_MANS = lrzip.1 lrunzip.1 lrzcat.1 lrztar.1 lrzuntar.1
|
||||
man1_MANS = lrzip.1 lrunzip.1 lrzcat.1 lrztar.1 lrzuntar.1 lrz.1
|
||||
man5_MANS = lrzip.conf.5
|
||||
|
||||
BUILT_SOURCES = lrunzip.1 lrzcat.1 lrztar.1 lrzuntar.1
|
||||
BUILT_SOURCES = lrunzip.1 lrzcat.1 lrztar.1 lrzuntar.1 lrz.1
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
EXTRA_DIST = lrzip.1 lrunzip.1.pod lrzcat.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 lrz.1.pod $(man5_MANS)
|
||||
|
||||
SUFFIXES = .1 .1.pod
|
||||
.1.pod.1:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright
|
||||
#
|
||||
# Copyright (C) 2010-2011 Con Kolivas
|
||||
# Copyright (C) 2010-2015 Con Kolivas
|
||||
# Copyright (C) 2009-2009 Jari Aalto
|
||||
#
|
||||
# License
|
||||
|
|
@ -70,6 +70,7 @@ lrzip(1),
|
|||
lrzcat(1),
|
||||
lrztar(1),
|
||||
lrzuntar(1),
|
||||
lrz(1),
|
||||
bzip2(1),
|
||||
gzip(1),
|
||||
lzop(1),
|
||||
|
|
|
|||
128
man/lrz.1.pod
Normal file
128
man/lrz.1.pod
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
# Copyright
|
||||
#
|
||||
# Copyright (C) 2015 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
|
||||
|
||||
lrz - gzip compatible command line variant of lrzip
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
lrz [OPTIONS] <file>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
lrz is identical to the lrzip application however its command line options are
|
||||
made to be as compatible with gzip as possible.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
lrz differs from lrzip by accepting the following commands:
|
||||
|
||||
General options:
|
||||
-c, --stdout output to STDOUT
|
||||
-C, --check check integrity of file written on decompression
|
||||
-d, --decompress decompress
|
||||
-e, --encrypt password protected sha512/aes128 encryption on compression
|
||||
-h, -?, --help show help
|
||||
-H, --hash display md5 hash integrity information
|
||||
-i, --info show compressed file information
|
||||
-L, --license display software version and license
|
||||
-P, --progress show compression progress
|
||||
-t, --test test compressed file integrity
|
||||
-v[v], --verbose Increase verbosity
|
||||
-V, --version show version
|
||||
Options affecting output:
|
||||
-f, --force force overwrite of any existing files
|
||||
-k, --keep don't delete source files on de/compression
|
||||
-K, --keep-broken keep broken or damaged output files
|
||||
-o, --outfile filename specify the output file name and/or path
|
||||
-O, --outdir directory specify the output directory when -o is not used
|
||||
-S, --suffix suffix specify compressed suffix (default '.lrz')
|
||||
Options affecting compression:
|
||||
-b, --bzip2 bzip2 compression
|
||||
-g, --gzip gzip compression using zlib
|
||||
-l, --lzo lzo compression (ultra fast)
|
||||
-n, --no-compress no backend compression - prepare for other compressor
|
||||
-z, --zpaq zpaq compression (best, extreme compression, extremely slow)
|
||||
Low level options:
|
||||
-1 .. -9 set lzma/bzip2/gzip compression level (1-9, default 7)
|
||||
--fast alias for -1
|
||||
--best alias for -9
|
||||
-L, --level level set lzma/bzip2/gzip compression level (1-9, default 7)
|
||||
-N, --nice-level value Set nice value to value (default 0)
|
||||
-p, --threads value Set processor count to override number of threads
|
||||
-m, --maxram size Set maximim available ram in hundreds of MB
|
||||
overrides detected ammount of available ram
|
||||
-T, --threshold Disable LZO compressibility testing
|
||||
-U, --unlimited Use unlimited window size beyond ramsize (potentially much slower)
|
||||
-w, --window size maximum compression window in hundreds of MB
|
||||
default chosen by heuristic dependent on ram and chosen compression
|
||||
|
||||
See also lrzip(1)
|
||||
|
||||
=head1 ENVIRONMENT
|
||||
|
||||
lrz uses the same environment and configuration files as lrzip(1)
|
||||
|
||||
=head1 FILES
|
||||
|
||||
See lrzip(1)
|
||||
|
||||
=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
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright
|
||||
#
|
||||
# Copyright (C) 2011 Con Kolivas
|
||||
# Copyright (C) 2011-2015 Con Kolivas
|
||||
#
|
||||
# License
|
||||
#
|
||||
|
|
@ -69,6 +69,7 @@ lrzip(1),
|
|||
lrunzip(1),
|
||||
lrztar(1),
|
||||
lrzuntar(1),
|
||||
lrz(1),
|
||||
bzip2(1),
|
||||
gzip(1),
|
||||
lzop(1),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.TH "lrzip" "1" "May 2011" "" ""
|
||||
.TH "lrzip" "1" "April 2015" "" ""
|
||||
.SH "NAME"
|
||||
lrzip \- a large-file compression program
|
||||
.SH "SYNOPSIS"
|
||||
|
|
@ -17,6 +17,8 @@ lrztar \-d [lrzip options] <directory>
|
|||
.br
|
||||
lrzuntar [lrzip options] <directory>
|
||||
.br
|
||||
lrz [lrz options] <directory>
|
||||
.br
|
||||
LRZIP=NOCONFIG [lrzip|lrunzip] [OPTIONS] <file>
|
||||
.PP
|
||||
.SH "DESCRIPTION"
|
||||
|
|
@ -331,6 +333,7 @@ lrunzip(1),
|
|||
lrzcat(1),
|
||||
lrztar(1),
|
||||
lrzuntar(1),
|
||||
lrz(1),
|
||||
bzip2(1),
|
||||
gzip(1),
|
||||
lzop(1),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright
|
||||
#
|
||||
# Copyright (C) 2010-2011 Con Kolivas
|
||||
# Copyright (C) 2010-2015 Con Kolivas
|
||||
# Copyright (C) 2009-2010 Jari Aalto
|
||||
#
|
||||
# License
|
||||
|
|
@ -74,6 +74,7 @@ lrzuntar(1),
|
|||
lrzip(1),
|
||||
lrunzip(1),
|
||||
lrzcat(1),
|
||||
lrz(1),
|
||||
bzip2(1),
|
||||
gzip(1),
|
||||
lzop(1),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright
|
||||
#
|
||||
# Copyright (C) 2010-2011 Con Kolivas
|
||||
# Copyright (C) 2010-2015 Con Kolivas
|
||||
#
|
||||
# License
|
||||
#
|
||||
|
|
@ -52,6 +52,7 @@ lrztar(1),
|
|||
lrzip(1),
|
||||
lrunzip(1),
|
||||
lrzcat(1),
|
||||
lrz(1),
|
||||
bzip2(1),
|
||||
gzip(1),
|
||||
lzop(1),
|
||||
|
|
|
|||
3
stream.c
3
stream.c
|
|
@ -703,7 +703,8 @@ ssize_t read_1g(rzip_control *control, int fd, void *buf, i64 len)
|
|||
/* We're decompressing from STDIN */
|
||||
if (unlikely(control->in_ofs + len > control->in_maxlen)) {
|
||||
/* We're unable to fit it all into the temp buffer */
|
||||
dump_stdin(control);
|
||||
if (dump_stdin(control))
|
||||
failure_return(("Inadequate ram to %compress from STDIN and unable to create in tmpfile"), -1);
|
||||
goto read_fd;
|
||||
}
|
||||
if (control->in_ofs + len > control->in_len) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue