mirror of
https://github.com/ckolivas/lrzip.git
synced 2026-04-21 06:03:54 +00:00
Make messages come via stdout instead of stderror courtesy of Alexander Saprykin
This commit is contained in:
parent
e3916090a4
commit
d972496aa8
7 changed files with 121 additions and 113 deletions
28
zpipe.cpp
28
zpipe.cpp
|
|
@ -1568,7 +1568,7 @@ bool find_start(FILE *in) {
|
|||
}
|
||||
|
||||
// Decompress to stdout
|
||||
static void decompress(FILE *in, FILE *out, long long int buf_len, int progress) {
|
||||
static void decompress(FILE *in, FILE *out, FILE *msgout, long long int buf_len, int progress) {
|
||||
|
||||
long long int len = 0;
|
||||
static int last_pct = 0, chunk = 0;
|
||||
|
|
@ -1601,8 +1601,8 @@ static void decompress(FILE *in, FILE *out, long long int buf_len, int progress)
|
|||
len++;
|
||||
pct = (len * 100 / buf_len);
|
||||
if (pct != last_pct) {
|
||||
fprintf(stderr, "\r ZPAQ Chunk %d of 2 Decompress: %i%% \r", (chunk + 1), pct);
|
||||
fflush(stderr);
|
||||
fprintf(msgout, "\r ZPAQ Chunk %d of 2 Decompress: %i%% \r", (chunk + 1), pct);
|
||||
fflush(msgout);
|
||||
last_pct = pct;
|
||||
}
|
||||
}
|
||||
|
|
@ -1624,15 +1624,15 @@ static void decompress(FILE *in, FILE *out, long long int buf_len, int progress)
|
|||
if (c!=255) error("missing end of block marker");
|
||||
}
|
||||
if (progress) {
|
||||
fprintf(stderr, "\t \r");
|
||||
fflush(stderr);
|
||||
fprintf(msgout, "\t \r");
|
||||
fflush(msgout);
|
||||
}
|
||||
chunk ^= 1;
|
||||
}
|
||||
|
||||
extern "C" void zpipe_decompress(FILE *in, FILE *out, long long int buf_len, int progress)
|
||||
extern "C" void zpipe_decompress(FILE *in, FILE *out, FILE *msgout, long long int buf_len, int progress)
|
||||
{
|
||||
decompress(in, out, buf_len, progress);
|
||||
decompress(in, out, msgout, buf_len, progress);
|
||||
}
|
||||
|
||||
//////////////////////////// Compressor ////////////////////////////
|
||||
|
|
@ -1694,7 +1694,7 @@ void Encoder::compress(int c) {
|
|||
//////////////////////////// Compress ////////////////////////////
|
||||
|
||||
// Compress to 1 segment in 1 block
|
||||
static void compress(FILE *in, FILE *out, long long int buf_len, int progress) {
|
||||
static void compress(FILE *in, FILE *out, FILE *msgout, long long int buf_len, int progress) {
|
||||
|
||||
// Compiled initialization lists generated by "zpaq vtrmid.cfg"
|
||||
static U8 header[71]={ // COMP 34 bytes from mid.cfg
|
||||
|
|
@ -1738,8 +1738,8 @@ static void compress(FILE *in, FILE *out, long long int buf_len, int progress) {
|
|||
len++;
|
||||
pct = (len * 100 / buf_len);
|
||||
if (pct != last_pct) {
|
||||
fprintf(stderr, "\r\tZPAQ Chunk %i of 2 compress: %i%% \r", (chunk + 1), pct);
|
||||
fflush(stderr);
|
||||
fprintf(msgout, "\r\tZPAQ Chunk %i of 2 compress: %i%% \r", (chunk + 1), pct);
|
||||
fflush(msgout);
|
||||
last_pct = pct;
|
||||
}
|
||||
}
|
||||
|
|
@ -1747,8 +1747,8 @@ static void compress(FILE *in, FILE *out, long long int buf_len, int progress) {
|
|||
sha1.put(c);
|
||||
}
|
||||
if (progress) {
|
||||
fprintf(stderr, "\t \r");
|
||||
fflush(stderr);
|
||||
fprintf(msgout, "\t \r");
|
||||
fflush(msgout);
|
||||
}
|
||||
enc.compress(-1); // end of segment
|
||||
|
||||
|
|
@ -1765,7 +1765,7 @@ static void compress(FILE *in, FILE *out, long long int buf_len, int progress) {
|
|||
chunk ^= 1;
|
||||
}
|
||||
|
||||
extern "C" void zpipe_compress(FILE *in, FILE *out, long long int buf_len, int progress)
|
||||
extern "C" void zpipe_compress(FILE *in, FILE *out, FILE *msgout, long long int buf_len, int progress)
|
||||
{
|
||||
compress(in, out, buf_len, progress);
|
||||
compress(in, out, msgout, buf_len, progress);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue