From 1d2c977a7eff95a52f77498397f1a6fffefcd68c Mon Sep 17 00:00:00 2001 From: circulosmeos Date: Fri, 15 Jul 2022 19:19:34 +0200 Subject: [PATCH] v1.5.0 --- README.md | 14 +++++++++++--- gztool.1 | 15 ++++++++++++++- gztool.c | 4 ++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 29db969..2a60e4d 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ Copy gztool.c to the directory where you compiled zlib, and do: Usage ===== - gztool (v1.4.3) + gztool (v1.5.0) GZIP files indexer, compressor and data retriever. Create small indexes for gzipped files and use them for quick and random-positioned data extraction. @@ -129,7 +129,7 @@ Usage -e: if multiple files are indicated, continue on error (if any). -E: end processing on first GZIP end of file marker at EOF. Nonetheless with `-c`, `-E` waits for more data even at EOF. - -f: force file overwriting if destination file already exists. + -f: force file overwriting if index file already exists. -F: force index creation/completion first, and then action: if `-F` is not used, index is created interleaved with actions. -h: print brief help; `-hh` prints this help. @@ -341,6 +341,14 @@ Take into account that, as shown, the first byte of the truncated `gzip_filename Please, note that index point positions at index file **may require also the previous byte** to be available in the truncated gzip file, as a gzip stream is not byte-rounded but a stream of pure bits. Thus **if you're thinking on truncating a gzip file, please do it always at least by one byte before the indicated index point in the gzip** - as said, it may not be needed, but in 7 of 8 cases it is needed. +* Since v1.5.0, using `-[fW]` (`-f`: force index overwriting; `-W`: do not write index) with `-[ST]` (`-S`: create index on still-growing gzip file; `-T`: tail and continue decompressing to stdout) indicates `gztool` to continue operations even after the source file is overwritten. If using `-f`, the index file will be overwritten. For example: + + $ gztool -WT log_filename.gz + ... + File overwriting detected and restarting decompression... + Processing 'log_filename.gz' ... + + Index file format ================= @@ -430,7 +438,7 @@ Other interesting links Version ======= -This version is **v1.4.3**. +This version is **v1.5.0**. Please, read the *Disclaimer*. In case of any errors, please open an [issue](https://github.com/circulosmeos/gztool/issues). diff --git a/gztool.1 b/gztool.1 index 6f12ecf..92000b9 100644 --- a/gztool.1 +++ b/gztool.1 @@ -4,7 +4,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH gztool 1 "Sep 30 2021" "gztool v1.4.3" +.TH gztool 1 "Jul 15 2022" "gztool v1.5.0" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -356,6 +356,19 @@ Take into account that, as shown, the first byte of the truncated `gzip_filename Please, note that index point positions at index file \fBmay require also the previous byte\fP to be available in the truncated gzip file, as gzip stream is not byte-rounded but a stream of pure bits. Thus \fIif you're thinking on truncating a gzip file, please do it always at least by one byte before the indicated index point in the gzip\fP - as said, it may not be needed, but in 7 of 8 cases it is needed. .br + +* Since v1.5.0, using `-[fW]` (`-f`: force index overwriting; `-W`: do not write index) with `-[ST]` (`-S`: create index on still-growing gzip file; `-T`: tail and continue decompressing to stdout) indicates `gztool` to continue operations even after the source file is overwritten. If using `-f`, the index file will be overwritten. For example: + + +.BR \ \ \ \ $\ gztool\ -WT\ log_filename.gz +.br +.BR \ \ \ \ ... +.br +.BR \ \ \ \ File\ overwriting\ detected\ and\ restarting\ decompression... +.br +.BR \ \ \ \ Processing\ 'log_filename.gz' ... +.br + .SH INTERNALS By default gzip-compressed files cannot be accessed in random mode: any byte required at position N requires the complete gzip file to be decompressed from the beginning to the N byte. Nonetheless Mark Adler, the author of zlib (//github.com/madler/zlib), provided years ago a cryptic file named `zran.c` (//github.com/madler/zlib/blob/master/examples/zran.c) that creates an "index" of "windows" filled with 32 kiB of uncompressed data at different positions along the un/compressed file, which can be used to initialize the zlib library and make it behave as if compressed data begin there. diff --git a/gztool.c b/gztool.c index fca39ab..2753a40 100644 --- a/gztool.c +++ b/gztool.c @@ -13,7 +13,7 @@ // // LICENSE: // -// v0.1 to v1.4* by Roberto S. Galende, 2019, 2020, 2021 +// v0.1 to v1.5* by Roberto S. Galende, 2019, 2020, 2021, 2022 // //github.com/circulosmeos/gztool // A work by Roberto S. Galende // distributed under the same License terms covering @@ -123,7 +123,7 @@ #include #else #define PACKAGE_NAME "gztool" - #define PACKAGE_VERSION "1.4.3" + #define PACKAGE_VERSION "1.5.0" #endif #define _XOPEN_SOURCE 500 // expose 's pread()