Skip to content

Commit

Permalink
v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
circulosmeos committed Jul 15, 2022
1 parent a28308c commit 1d2c977
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
=================

Expand Down Expand Up @@ -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).

Expand Down
15 changes: 14 additions & 1 deletion gztool.1
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions gztool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -123,7 +123,7 @@
#include <config.h>
#else
#define PACKAGE_NAME "gztool"
#define PACKAGE_VERSION "1.4.3"
#define PACKAGE_VERSION "1.5.0"
#endif

#define _XOPEN_SOURCE 500 // expose <unistd.h>'s pread()
Expand Down

0 comments on commit 1d2c977

Please sign in to comment.