Skip to content

Commit

Permalink
Merge pull request #857 from t-mat/fix/ignore-missing-manpages
Browse files Browse the repository at this point in the history
Add --ignore-missing and --binary to --help and xxhsum.1
  • Loading branch information
Cyan4973 authored Jul 12, 2023
2 parents bea4423 + 4a47319 commit 0ac3a27
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 99 deletions.
105 changes: 30 additions & 75 deletions cli/xxhsum.1
Original file line number Diff line number Diff line change
@@ -1,165 +1,120 @@
.
.TH "XXHSUM" "1" "June 2023" "xxhsum 0.8.2" "User Commands"
.
.TH "XXHSUM" "1" "July 2023" "xxhsum 0.8.2" "User Commands"
.SH "NAME"
\fBxxhsum\fR \- print or check xxHash non\-cryptographic checksums
.
.SH "SYNOPSIS"
\fBxxhsum [<OPTION>] \.\.\. [<FILE>] \.\.\.\fR \fBxxhsum \-b [<OPTION>] \.\.\.\fR
.
\fBxxhsum\fR [\fIOPTION\fR]\|\.\|\.\|\. [\fIFILE\fR]\|\.\|\.\|\.
.br
\fBxxhsum \-b\fR [\fIOPTION\fR]\|\.\|\.\|\.
.P
\fBxxh32sum\fR is equivalent to \fBxxhsum \-H0\fR, \fBxxh64sum\fR is equivalent to \fBxxhsum \-H1\fR, \fBxxh128sum\fR is equivalent to \fBxxhsum \-H2\fR\.
.
.SH "DESCRIPTION"
Print or check xxHash (32, 64 or 128 bits) checksums\. When no \fIFILE\fR, read standard input, except if it\'s the console\. When \fIFILE\fR is \fB\-\fR, read standard input even if it\'s the console\.
.
Print or check xxHash (32, 64 or 128 bits) checksums\.
.br
When no \fIFILE\fR, read standard input, except if it's the console\. When \fIFILE\fR is \fB\-\fR, read standard input even if it's the console\.
.P
\fBxxhsum\fR supports a command line syntax similar but not identical to md5sum(1)\. Differences are: \fBxxhsum\fR doesn\'t have text/binary mode switch (\fB\-b\fR, \fB\-t\fR); \fBxxhsum\fR always treats files as binary file; \fBxxhsum\fR has a hash selection switch (\fB\-H\fR);
.
\fBxxhsum\fR supports a command line syntax similar but not identical to md5sum(1)\. Differences are:
.IP "\[ci]" 4
\fBxxhsum\fR doesn't have text mode switch (\fB\-t\fR)
.IP "\[ci]" 4
\fBxxhsum\fR doesn't have short binary mode switch (\fB\-b\fR)
.IP "\[ci]" 4
\fBxxhsum\fR always treats files as binary file
.IP "\[ci]" 4
\fBxxhsum\fR has a hash selection switch (\fB\-H\fR)
.IP "" 0
.P
As xxHash is a fast non\-cryptographic checksum algorithm, \fBxxhsum\fR should not be used for security related purposes\.
.
.P
\fBxxhsum \-b\fR invokes benchmark mode\. See \fIOPTIONS\fR and \fIEXAMPLES\fR for details\.
.
\fBxxhsum \-b\fR invokes benchmark mode\. See OPTIONS and EXAMPLES for details\.
.SH "OPTIONS"
.
.TP
\fB\-V\fR, \fB\-\-version\fR
Displays xxhsum version and exits
.
.TP
\fB\-H\fR\fIHASHTYPE\fR
Hash selection\. \fIHASHTYPE\fR means \fB0\fR=XXH32, \fB1\fR=XXH64, \fB2\fR=XXH128, \fB3\fR=XXH3\. Note that \fB\-H3\fR triggers \fB\-\-tag\fR, which can\'t be skipped (this is to reduce risks of confusion with \fB\-H2\fR (\fBXXH64\fR))\. Alternatively, \fIHASHTYPE\fR \fB32\fR=XXH32, \fB64\fR=XXH64, \fB128\fR=XXH128\. Default value is \fB1\fR (XXH64)
.
Hash selection\. \fIHASHTYPE\fR means \fB0\fR=XXH32, \fB1\fR=XXH64, \fB2\fR=XXH128, \fB3\fR=XXH3\. Note that \fB\-H3\fR triggers \fB\-\-tag\fR, which can't be skipped (this is to reduce risks of confusion with \fB\-H2\fR (\fBXXH64\fR))\. Alternatively, \fIHASHTYPE\fR \fB32\fR=XXH32, \fB64\fR=XXH64, \fB128\fR=XXH128\. Default value is \fB1\fR (XXH64)
.TP
\fB\-\-binary\fR
Read in binary mode\.
.TP
\fB\-\-tag\fR
Output in the BSD style\.
.
.TP
\fB\-\-little\-endian\fR
Set output hexadecimal checksum value as little endian convention\. By default, value is displayed as big endian\.
.
.TP
\fB\-h\fR, \fB\-\-help\fR
Displays help and exits
.
.P
\fBThe following four options are useful only when verifying checksums (\fB\-c\fR)\fR
.
.SS "The following options are useful only when verifying checksums (\-c):"
.TP
\fB\-c\fR, \fB\-\-check\fR \fIFILE\fR
Read xxHash sums from \fIFILE\fR and check them
.
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Don\'t print OK for each successfully verified file
.
Don't print OK for each successfully verified file
.TP
\fB\-\-strict\fR
Return an error code if any line in the file is invalid, not just if some checksums are wrong\. This policy is disabled by default, though UI will prompt an informational message if any line in the file is detected invalid\.
.
.TP
\fB\-\-status\fR
Don\'t output anything\. Status code shows success\.
.
Don't output anything\. Status code shows success\.
.TP
\fB\-w\fR, \fB\-\-warn\fR
Emit a warning message about each improperly formatted checksum line\.
.
.P
\fBThe following options are useful only benchmark purpose\fR
.
.SS "The following options are useful only benchmark purpose:"
.TP
\fB\-b\fR
Benchmark mode\. See \fIEXAMPLES\fR for details\.
.
Benchmark mode\. See EXAMPLES for details\.
.TP
\fB\-b#\fR
Specify ID of variant to be tested\. Multiple variants can be selected, separated by a \',\' comma\.
.
Specify ID of variant to be tested\. Multiple variants can be selected, separated by a ',' comma\.
.TP
\fB\-B\fR\fIBLOCKSIZE\fR
Only useful for benchmark mode (\fB\-b\fR)\. See \fIEXAMPLES\fR for details\. \fIBLOCKSIZE\fR specifies benchmark mode\'s test data block size in bytes\. Default value is 102400
.
Only useful for benchmark mode (\fB\-b\fR)\. See \fIEXAMPLES\fR for details\. \fIBLOCKSIZE\fR specifies benchmark mode's test data block size in bytes\. Default value is 102400
.TP
\fB\-i\fR\fIITERATIONS\fR
Only useful for benchmark mode (\fB\-b\fR)\. See \fIEXAMPLES\fR for details\. \fIITERATIONS\fR specifies number of iterations in benchmark\. Single iteration lasts approximately 1000 milliseconds\. Default value is 3
.
.SH "EXIT STATUS"
\fBxxhsum\fR exit \fB0\fR on success, \fB1\fR if at least one file couldn\'t be read or doesn\'t have the same checksum as the \fB\-c\fR option\.
.
\fBxxhsum\fR exit \fB0\fR on success, \fB1\fR if at least one file couldn't be read or doesn't have the same checksum as the \fB\-c\fR option\.
.SH "EXAMPLES"
Output xxHash (64bit) checksum values of specific files to standard output
.
.IP "" 4
.
.nf

$ xxhsum \-H1 foo bar baz
.
.fi
.
.IP "" 0
.
.P
Output xxHash (32bit and 64bit) checksum values of specific files to standard output, and redirect it to \fBxyz\.xxh32\fR and \fBqux\.xxh64\fR
.
.IP "" 4
.
.nf

$ xxhsum \-H0 foo bar baz > xyz\.xxh32
$ xxhsum \-H1 foo bar baz > qux\.xxh64
.
.fi
.
.IP "" 0
.
.P
Read xxHash sums from specific files and check them
.
.IP "" 4
.
.nf

$ xxhsum \-c xyz\.xxh32 qux\.xxh64
.
.fi
.
.IP "" 0
.
.P
Benchmark xxHash algorithm\. By default, \fBxxhsum\fR benchmarks xxHash main variants on a synthetic sample of 100 KB, and print results into standard output\. The first column is the algorithm, the second column is the source data size in bytes, the third column is the number of hashes generated per second (throughput), and finally the last column translates speed in megabytes per second\.
.
.IP "" 4
.
.nf

$ xxhsum \-b
.
.fi
.
.IP "" 0
.
.P
In the following example, the sample to hash is set to 16384 bytes, the variants to be benched are selected by their IDs, and each benchmark test is repeated 10 times, for increased accuracy\.
.
.IP "" 4
.
.nf

$ xxhsum \-b1,2,3 \-i10 \-B16384
.
.fi
.
.IP "" 0
.
.SH "BUGS"
Report bugs at: https://github\.com/Cyan4973/xxHash/issues/
.
.SH "AUTHOR"
Yann Collet
.
.SH "SEE ALSO"
md5sum(1)
50 changes: 27 additions & 23 deletions cli/xxhsum.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ xxhsum(1) -- print or check xxHash non-cryptographic checksums
SYNOPSIS
--------

`xxhsum [<OPTION>] ... [<FILE>] ...`
`xxhsum -b [<OPTION>] ...`
`xxhsum` [*OPTION*]... [*FILE*]...
`xxhsum -b` [*OPTION*]...

`xxh32sum` is equivalent to `xxhsum -H0`,
`xxh64sum` is equivalent to `xxhsum -H1`,
Expand All @@ -15,34 +15,38 @@ SYNOPSIS
DESCRIPTION
-----------

Print or check xxHash (32, 64 or 128 bits) checksums.
When no <FILE>, read standard input, except if it's the console.
When <FILE> is `-`, read standard input even if it's the console.
Print or check xxHash (32, 64 or 128 bits) checksums.
When no *FILE*, read standard input, except if it's the console.
When *FILE* is `-`, read standard input even if it's the console.

`xxhsum` supports a command line syntax similar but not identical to md5sum(1).
Differences are:
`xxhsum` doesn't have text/binary mode switch (`-b`, `-t`);
`xxhsum` always treats files as binary file;
`xxhsum` has a hash selection switch (`-H`);
`xxhsum` supports a command line syntax similar but not identical to md5sum(1). Differences are:

* `xxhsum` doesn't have text mode switch (`-t`)
* `xxhsum` doesn't have short binary mode switch (`-b`)
* `xxhsum` always treats files as binary file
* `xxhsum` has a hash selection switch (`-H`)

As xxHash is a fast non-cryptographic checksum algorithm,
`xxhsum` should not be used for security related purposes.

`xxhsum -b` invokes benchmark mode. See [OPTIONS](#OPTIONS) and [EXAMPLES](#EXAMPLES) for details.
`xxhsum -b` invokes benchmark mode. See OPTIONS and EXAMPLES for details.

OPTIONS
-------

* `-V`, `--version`:
Displays xxhsum version and exits

* `-H`<HASHTYPE>:
Hash selection. <HASHTYPE> means `0`=XXH32, `1`=XXH64, `2`=XXH128, `3`=XXH3.
* `-H`*HASHTYPE*:
Hash selection. *HASHTYPE* means `0`=XXH32, `1`=XXH64, `2`=XXH128, `3`=XXH3.
Note that `-H3` triggers `--tag`, which can't be skipped
(this is to reduce risks of confusion with `-H2` (`XXH64`)).
Alternatively, <HASHTYPE> `32`=XXH32, `64`=XXH64, `128`=XXH128.
Alternatively, *HASHTYPE* `32`=XXH32, `64`=XXH64, `128`=XXH128.
Default value is `1` (XXH64)

* `--binary`:
Read in binary mode.

* `--tag`:
Output in the BSD style.

Expand All @@ -53,10 +57,10 @@ OPTIONS
* `-h`, `--help`:
Displays help and exits

**The following four options are useful only when verifying checksums (`-c`)**
### The following options are useful only when verifying checksums (-c):

* `-c`, `--check` <FILE>:
Read xxHash sums from <FILE> and check them
* `-c`, `--check` *FILE*:
Read xxHash sums from *FILE* and check them

* `-q`, `--quiet`:
Don't print OK for each successfully verified file
Expand All @@ -74,22 +78,22 @@ OPTIONS
* `-w`, `--warn`:
Emit a warning message about each improperly formatted checksum line.

**The following options are useful only benchmark purpose**
### The following options are useful only benchmark purpose:

* `-b`:
Benchmark mode. See [EXAMPLES](#EXAMPLES) for details.
Benchmark mode. See EXAMPLES for details.

* `-b#`:
Specify ID of variant to be tested.
Multiple variants can be selected, separated by a ',' comma.

* `-B`<BLOCKSIZE>:
Only useful for benchmark mode (`-b`). See [EXAMPLES](#EXAMPLES) for details.
* `-B`*BLOCKSIZE*:
Only useful for benchmark mode (`-b`). See *EXAMPLES* for details.
<BLOCKSIZE> specifies benchmark mode's test data block size in bytes.
Default value is 102400

* `-i`<ITERATIONS>:
Only useful for benchmark mode (`-b`). See [EXAMPLES](#EXAMPLES) for details.
* `-i`*ITERATIONS*:
Only useful for benchmark mode (`-b`). See *EXAMPLES* for details.
<ITERATIONS> specifies number of iterations in benchmark. Single iteration
lasts approximately 1000 milliseconds. Default value is 3

Expand Down
4 changes: 3 additions & 1 deletion cli/xxhsum.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,16 +1097,18 @@ static int XSUM_usage_advanced(const char* exename)
XSUM_log( " -V, --version Display version information \n");
XSUM_log( " --tag Produce BSD-style checksum lines \n");
XSUM_log( " --little-endian Checksum values use little endian convention (default: big endian) \n");
XSUM_log( " --binary Read in binary mode \n");
XSUM_log( " -b Run benchmark \n");
XSUM_log( " -b# Bench only algorithm variant # \n");
XSUM_log( " -i# Number of times to run the benchmark (default: %i) \n", NBLOOPS_DEFAULT);
XSUM_log( " -q, --quiet Don't display version header in benchmark mode \n");
XSUM_log( "\n");
XSUM_log( "The following four options are useful only when verifying checksums (-c): \n");
XSUM_log( "The following five options are useful only when verifying checksums (-c): \n");
XSUM_log( " -q, --quiet Don't print OK for each successfully verified file \n");
XSUM_log( " --status Don't output anything, status code shows success \n");
XSUM_log( " --strict Exit non-zero for improperly formatted checksum lines \n");
XSUM_log( " --warn Warn about improperly formatted checksum lines \n");
XSUM_log( " --ignore-missing Don't fail or report status for missing files \n");
return 0;
}

Expand Down

0 comments on commit 0ac3a27

Please sign in to comment.