Merging upstream version 1.14~rc1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
1ef198b95d
commit
acae34f9f5
26 changed files with 387 additions and 232 deletions
3
COPYING
3
COPYING
|
@ -1,8 +1,7 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2024-11-29 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 1.14-rc1 released.
|
||||
* zupdate.cc: '-r -d' now keeps last component of dir arguments.
|
||||
* zutils.texi: New chapter 'Syntax of command-line arguments'.
|
||||
* check.sh: Use 'cp' instead of 'cat'.
|
||||
|
||||
2024-01-23 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
* Version 1.13 released.
|
||||
|
@ -110,7 +117,7 @@
|
|||
* zdiff.cc (set_fifonames): Use '_' if both names are different.
|
||||
* configure: Avoid warning on some shells when testing for g++.
|
||||
* Makefile.in: Detect the existence of install-info.
|
||||
* check.sh: A POSIX shell is required to run the tests.
|
||||
* check.sh: Require a POSIX shell.
|
||||
|
||||
2015-05-29 Antonio Diaz Diaz <antonio@gnu.org>
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ DISTNAME = $(pkgname)-$(pkgversion)
|
|||
INSTALL = install
|
||||
INSTALL_PROGRAM = $(INSTALL) -m 755
|
||||
INSTALL_SCRIPT = $(INSTALL) -m 755
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
INSTALL_DIR = $(INSTALL) -d -m 755
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
SHELL = /bin/sh
|
||||
CAN_RUN_INSTALLINFO = $(SHELL) -c "install-info --version" > /dev/null 2>&1
|
||||
|
||||
|
@ -68,7 +68,8 @@ zgrep.o : zgrep.cc
|
|||
|
||||
# prevent 'make' from trying to remake source files
|
||||
$(VPATH)/configure $(VPATH)/Makefile.in $(VPATH)/doc/$(pkgname).texi : ;
|
||||
%.h %.cc : ;
|
||||
MAKEFLAGS += -r
|
||||
.SUFFIXES :
|
||||
|
||||
$(objs) : Makefile
|
||||
$(scripts) : Makefile
|
||||
|
|
22
NEWS
22
NEWS
|
@ -1,18 +1,8 @@
|
|||
Changes in version 1.13:
|
||||
Changes in version 1.14:
|
||||
|
||||
The detection of bzip2 files with no compressed blocks has been fixed.
|
||||
(Error introduced in version 1.9).
|
||||
'zupdate --recursive --destdir=dir' now keeps the file name component
|
||||
following the last slash in directory arguments;
|
||||
'../a' recompresses the file ../a/b.gz to dir/a/b.lz, while
|
||||
'../a/' recompresses the file ../a/b.gz to dir/b.lz.
|
||||
|
||||
When zcat, zcmp, zdiff, or zgrep need to try compressed file names, gzip
|
||||
(.gz) is now tried before bzip2 (.bz2).
|
||||
|
||||
When only one compressed file is passed to zcmp or zdiff, they now try to
|
||||
compare it with a compressed file of any of the remaining formats if the
|
||||
corresponding uncompressed file does not exist.
|
||||
|
||||
zcmp now reports EOF on empty file like GNU cmp:
|
||||
"zcmp: EOF on FILE which is empty".
|
||||
|
||||
File diagnostics in zupdate have been reformatted as 'PROGRAM: FILE: MESSAGE'.
|
||||
|
||||
The variable MAKEINFO has been added to configure and Makefile.in.
|
||||
The chapter 'Syntax of command-line arguments' has been added to the manual.
|
||||
|
|
9
README
9
README
|
@ -1,3 +1,5 @@
|
|||
See the file INSTALL for compilation and installation instructions.
|
||||
|
||||
Description
|
||||
|
||||
Zutils is a collection of utilities able to process any combination of
|
||||
|
@ -8,8 +10,8 @@ created. Data format is detected by its identifier string (magic bytes), not
|
|||
by the file name extension. Empty files are considered uncompressed.
|
||||
|
||||
These utilities are not wrapper scripts but safer and more efficient C++
|
||||
programs. In particular the option '--recursive' is very efficient in
|
||||
those utilities supporting it.
|
||||
programs. In particular the option '--recursive' is efficient in those
|
||||
utilities supporting it.
|
||||
|
||||
The utilities provided are zcat, zcmp, zdiff, zgrep, ztest, and zupdate.
|
||||
The formats supported are bzip2, gzip, lzip, xz, and zstd.
|
||||
|
@ -39,6 +41,9 @@ LANGUAGE NOTE: Uncompressed = not compressed = plain data; it may never have
|
|||
been compressed. Decompressed is used to refer to data which have undergone
|
||||
the process of decompression.
|
||||
|
||||
Zutils uses Arg_parser for command-line argument parsing:
|
||||
http://www.nongnu.org/arg-parser/arg_parser.html
|
||||
|
||||
|
||||
Copyright (C) 2009-2024 Antonio Diaz Diaz.
|
||||
|
||||
|
|
|
@ -75,19 +75,19 @@ bool Arg_parser::parse_long_option( const char * const opt, const char * const a
|
|||
error_ += "' requires an argument";
|
||||
return false;
|
||||
}
|
||||
data.back().argument = &opt[len+3];
|
||||
data.back().argument = &opt[len+3]; // argument may be empty
|
||||
return true;
|
||||
}
|
||||
|
||||
if( options[index].has_arg == yes )
|
||||
if( options[index].has_arg == yes || options[index].has_arg == yme )
|
||||
{
|
||||
if( !arg || !arg[0] )
|
||||
if( !arg || ( options[index].has_arg == yes && !arg[0] ) )
|
||||
{
|
||||
error_ = "option '--"; error_ += options[index].long_name;
|
||||
error_ += "' requires an argument";
|
||||
return false;
|
||||
}
|
||||
++argind; data.back().argument = arg;
|
||||
++argind; data.back().argument = arg; // argument may be empty
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -123,15 +123,16 @@ bool Arg_parser::parse_short_option( const char * const opt, const char * const
|
|||
{
|
||||
data.back().argument = &opt[cind]; ++argind; cind = 0;
|
||||
}
|
||||
else if( options[index].has_arg == yes )
|
||||
else if( options[index].has_arg == yes || options[index].has_arg == yme )
|
||||
{
|
||||
if( !arg || !arg[0] )
|
||||
if( !arg || ( options[index].has_arg == yes && !arg[0] ) )
|
||||
{
|
||||
error_ = "option requires an argument -- '"; error_ += c;
|
||||
error_ += '\'';
|
||||
return false;
|
||||
}
|
||||
data.back().argument = arg; ++argind; cind = 0;
|
||||
++argind; cind = 0;
|
||||
data.back().argument = arg; // argument may be empty
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
10
arg_parser.h
10
arg_parser.h
|
@ -36,14 +36,18 @@
|
|||
The argument '--' terminates all options; any following arguments are
|
||||
treated as non-option arguments, even if they begin with a hyphen.
|
||||
|
||||
The syntax for optional option arguments is '-<short_option><argument>'
|
||||
(without whitespace), or '--<long_option>=<argument>'.
|
||||
The syntax of options with an optional argument is
|
||||
'-<short_option><argument>' (without whitespace), or
|
||||
'--<long_option>=<argument>'.
|
||||
|
||||
The syntax of options with an empty argument is '-<short_option> ""',
|
||||
'--<long_option> ""', or '--<long_option>=""'.
|
||||
*/
|
||||
|
||||
class Arg_parser
|
||||
{
|
||||
public:
|
||||
enum Has_arg { no, yes, maybe };
|
||||
enum Has_arg { no, yes, maybe, yme }; // yme = yes but maybe empty
|
||||
|
||||
struct Option
|
||||
{
|
||||
|
|
4
configure
vendored
4
configure
vendored
|
@ -6,7 +6,7 @@
|
|||
# to copy, distribute, and modify it.
|
||||
|
||||
pkgname=zutils
|
||||
pkgversion=1.13
|
||||
pkgversion=1.14-rc1
|
||||
srctrigger=doc/${pkgname}.texi
|
||||
|
||||
# clear some things potentially inherited from environment.
|
||||
|
@ -118,7 +118,7 @@ while [ $# != 0 ] ; do
|
|||
exit 1 ;;
|
||||
esac
|
||||
|
||||
# Check if the option took a separate argument
|
||||
# Check whether the option took a separate argument
|
||||
if [ "${arg2}" = yes ] ; then
|
||||
if [ $# != 0 ] ; then args="${args} \"$1\"" ; shift
|
||||
else echo "configure: Missing argument to '${option}'" 1>&2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
|
||||
.TH ZCAT "1" "January 2024" "zutils 1.13" "User Commands"
|
||||
.TH ZCAT "1" "November 2024" "zutils 1.14-rc1" "User Commands"
|
||||
.SH NAME
|
||||
zcat \- decompress and concatenate files to standard output
|
||||
.SH SYNOPSIS
|
||||
|
@ -38,6 +38,12 @@ equivalent to '\-vET'
|
|||
\fB\-b\fR, \fB\-\-number\-nonblank\fR
|
||||
number nonblank output lines
|
||||
.TP
|
||||
\fB\-c\fR, \fB\-\-stdout\fR
|
||||
ignored, for gzip compatibility
|
||||
.TP
|
||||
\fB\-d\fR, \fB\-\-decompress\fR
|
||||
ignored, for gzip compatibility
|
||||
.TP
|
||||
\fB\-e\fR
|
||||
equivalent to '\-vE'
|
||||
.TP
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
|
||||
.TH ZCMP "1" "January 2024" "zutils 1.13" "User Commands"
|
||||
.TH ZCMP "1" "November 2024" "zutils 1.14-rc1" "User Commands"
|
||||
.SH NAME
|
||||
zcmp \- decompress and compare two files byte by byte
|
||||
.SH SYNOPSIS
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
|
||||
.TH ZDIFF "1" "January 2024" "zutils 1.13" "User Commands"
|
||||
.TH ZDIFF "1" "November 2024" "zutils 1.14-rc1" "User Commands"
|
||||
.SH NAME
|
||||
zdiff \- decompress and compare two files line by line
|
||||
.SH SYNOPSIS
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
|
||||
.TH ZGREP "1" "January 2024" "zutils 1.13" "User Commands"
|
||||
.TH ZGREP "1" "November 2024" "zutils 1.14-rc1" "User Commands"
|
||||
.SH NAME
|
||||
zgrep \- search compressed files for a regular expression
|
||||
.SH SYNOPSIS
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
|
||||
.TH ZTEST "1" "January 2024" "zutils 1.13" "User Commands"
|
||||
.TH ZTEST "1" "November 2024" "zutils 1.14-rc1" "User Commands"
|
||||
.SH NAME
|
||||
ztest \- check the integrity of compressed files
|
||||
.SH SYNOPSIS
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2.
|
||||
.TH ZUPDATE "1" "January 2024" "zutils 1.13" "User Commands"
|
||||
.TH ZUPDATE "1" "November 2024" "zutils 1.14-rc1" "User Commands"
|
||||
.SH NAME
|
||||
zupdate \- recompress bzip2, gzip, xz, zstd files to lzip format
|
||||
.SH SYNOPSIS
|
||||
|
@ -97,7 +97,7 @@ set compressor and options for xz format
|
|||
\fB\-\-zst=\fR<command>
|
||||
set compressor and options for zstd format
|
||||
.PP
|
||||
Valid formats for option '\-M' are 'bz2', 'gz', 'lz', 'xz', and 'zst'.
|
||||
Valid formats for option '\-M' are 'bz2', 'gz', 'xz', and 'zst'.
|
||||
.SH "REPORTING BUGS"
|
||||
Report bugs to zutils\-bug@nongnu.org
|
||||
.br
|
||||
|
|
164
doc/zutils.info
164
doc/zutils.info
|
@ -11,7 +11,7 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir)
|
|||
Zutils Manual
|
||||
*************
|
||||
|
||||
This manual is for Zutils (version 1.13, 23 January 2024).
|
||||
This manual is for Zutils (version 1.14-rc1, 29 November 2024).
|
||||
|
||||
* Menu:
|
||||
|
||||
|
@ -24,6 +24,7 @@ This manual is for Zutils (version 1.13, 23 January 2024).
|
|||
* Zgrep:: Searching inside compressed files
|
||||
* Ztest:: Testing the integrity of compressed files
|
||||
* Zupdate:: Recompressing files to lzip format
|
||||
* Argument syntax:: By convention, options start with a hyphen
|
||||
* Problems:: Reporting bugs
|
||||
* Concept index:: Index of concepts
|
||||
|
||||
|
@ -47,7 +48,7 @@ created. Data format is detected by its identifier string (magic bytes), not
|
|||
by the file name extension. Empty files are considered uncompressed.
|
||||
|
||||
These utilities are not wrapper scripts but safer and more efficient C++
|
||||
programs. In particular the option '--recursive' is very efficient in those
|
||||
programs. In particular the option '--recursive' is efficient in those
|
||||
utilities supporting it.
|
||||
|
||||
The utilities provided are 'zcat', 'zcmp', 'zdiff', 'zgrep', 'ztest', and
|
||||
|
@ -89,10 +90,10 @@ File: zutils.info, Node: Common options, Next: Configuration, Prev: Introduct
|
|||
2 Common options
|
||||
****************
|
||||
|
||||
The following options: are available in all the utilities. Rather than
|
||||
The following options are available in all the utilities. Rather than
|
||||
writing identical descriptions for each of the programs, they are described
|
||||
here. Remember to prepend './' to any file name beginning with a hyphen, or
|
||||
use '--'. *Note Argument syntax: (arg_parser)Argument syntax.
|
||||
use '--'. *Note Argument syntax::.
|
||||
|
||||
'-h'
|
||||
'--help'
|
||||
|
@ -113,7 +114,7 @@ use '--'. *Note Argument syntax: (arg_parser)Argument syntax.
|
|||
'--format=FORMAT_LIST'
|
||||
Process only the formats listed in the comma-separated FORMAT_LIST.
|
||||
Valid formats are 'bz2', 'gz', 'lz', 'xz', 'zst', and 'un' for
|
||||
'uncompressed', meaning "any file name without a known extension".
|
||||
'uncompressed', meaning 'any file name without a known extension'.
|
||||
This option excludes files based on extension, instead of format,
|
||||
because it is more efficient. The exclusion only applies to names
|
||||
generated automatically (for example when adding extensions to a file
|
||||
|
@ -153,7 +154,7 @@ use '--'. *Note Argument syntax: (arg_parser)Argument syntax.
|
|||
2. If the option '-q' is passed to zutils, the compression program
|
||||
must also accept it.
|
||||
|
||||
3. It must return 0 if no errors occurred, and a non-zero value
|
||||
3. It must return 0 if no errors occurred, and a nonzero value
|
||||
otherwise.
|
||||
|
||||
|
||||
|
@ -164,6 +165,7 @@ and may be followed by a multiplier and an optional 'B' for "byte".
|
|||
Table of SI and binary prefixes (unit multipliers):
|
||||
|
||||
Prefix Value | Prefix Value
|
||||
----------------------------------------------------------------------
|
||||
k kilobyte (10^3 = 1000) | Ki kibibyte (2^10 = 1024)
|
||||
M megabyte (10^6) | Mi mebibyte (2^20)
|
||||
G gigabyte (10^9) | Gi gibibyte (2^30)
|
||||
|
@ -239,6 +241,12 @@ Exit status is 0 if no errors occurred, 1 otherwise.
|
|||
Number all nonblank output lines, starting with 1. The line count is
|
||||
unlimited.
|
||||
|
||||
'-c'
|
||||
'--stdout'
|
||||
'-d'
|
||||
'--decompress'
|
||||
Ignored, for gzip compatibility.
|
||||
|
||||
'-e'
|
||||
Equivalent to '-vE'.
|
||||
|
||||
|
@ -287,8 +295,8 @@ Exit status is 0 if no errors occurred, 1 otherwise.
|
|||
'-v'
|
||||
'--show-nonprinting'
|
||||
Print control characters except for LF (newline) and TAB using '^'
|
||||
notation and precede characters larger than 127 with 'M-' (which
|
||||
stands for "meta").
|
||||
notation and precede characters larger than 127 with 'M-' (which stands
|
||||
for "meta").
|
||||
|
||||
'--verbose'
|
||||
Verbose mode. Show error messages. Repeating it increases the verbosity
|
||||
|
@ -356,10 +364,10 @@ differences were found, and 2 means trouble.
|
|||
Force the compressed formats given. If FORMAT1 or FORMAT2 is omitted,
|
||||
the corresponding format is automatically detected. Valid values for
|
||||
FORMAT are 'bz2', 'gz', 'lz', 'xz', 'zst', and 'un' for
|
||||
'uncompressed'. If at least one format is specified with this option,
|
||||
the file is passed to the corresponding decompressor (or transmitted
|
||||
unmodified) without checking its format, and the exact file names of
|
||||
both FILE1 and FILE2 must be given. Other names are not tried.
|
||||
'uncompressed'. If this option is specified, the corresponding file is
|
||||
passed to the decompressor (or transmitted unmodified) without
|
||||
checking its format, and the exact file names of both FILE1 and FILE2
|
||||
must be given. Other names are not tried.
|
||||
|
||||
'-q'
|
||||
'--quiet'
|
||||
|
@ -409,8 +417,8 @@ remaining formats until one is found. *Note search-order::.
|
|||
An exit status of 0 means no differences were found, 1 means some
|
||||
differences were found, and 2 means trouble.
|
||||
|
||||
'zdiff' supports the following options (some options only work if the
|
||||
diff program used supports them):
|
||||
'zdiff' supports the following options (some options only work if the diff
|
||||
program used supports them):
|
||||
|
||||
'-a'
|
||||
'--text'
|
||||
|
@ -449,10 +457,10 @@ diff program used supports them):
|
|||
Force the compressed formats given. If FORMAT1 or FORMAT2 is omitted,
|
||||
the corresponding format is automatically detected. Valid values for
|
||||
FORMAT are 'bz2', 'gz', 'lz', 'xz', 'zst', and 'un' for
|
||||
'uncompressed'. If at least one format is specified with this option,
|
||||
the file is passed to the corresponding decompressor (or transmitted
|
||||
unmodified) without checking its format, and the exact file names of
|
||||
both FILE1 and FILE2 must be given. Other names are not tried.
|
||||
'uncompressed'. If this option is specified, the corresponding file is
|
||||
passed to the decompressor (or transmitted unmodified) without
|
||||
checking its format, and the exact file names of both FILE1 and FILE2
|
||||
must be given. Other names are not tried.
|
||||
|
||||
'-p'
|
||||
'--show-c-function'
|
||||
|
@ -536,9 +544,9 @@ with a nonzero status because base64 cannot write to its output pipe after
|
|||
An exit status of 0 means at least one match was found, 1 means no matches
|
||||
were found, and 2 means trouble.
|
||||
|
||||
'zgrep' supports the following options (Some options only work if the
|
||||
grep program used supports them. Options -h, -H, -r, -R, and -Z are managed
|
||||
by 'zgrep' and not passed to grep):
|
||||
'zgrep' supports the following options (Some options only work if the grep
|
||||
program used supports them. Options -h, -H, -r, -R, and -Z are managed by
|
||||
'zgrep' and not passed to grep):
|
||||
|
||||
'-a'
|
||||
'--text'
|
||||
|
@ -680,8 +688,8 @@ by 'zgrep' and not passed to grep):
|
|||
|
||||
'-U'
|
||||
'--binary'
|
||||
Use binary I/O on platforms affected by the bug known as "text mode
|
||||
I/O". (MS-DOS, MS-Windows, OS/2).
|
||||
Use binary I/O on platforms affected by the bug known as 'text mode
|
||||
I/O'. (MS-DOS, MS-Windows, OS/2).
|
||||
|
||||
'-v'
|
||||
'--invert-match'
|
||||
|
@ -781,7 +789,7 @@ incorrect file name extension.
|
|||
|
||||
|
||||
|
||||
File: zutils.info, Node: Zupdate, Next: Problems, Prev: Ztest, Up: Top
|
||||
File: zutils.info, Node: Zupdate, Next: Argument syntax, Prev: Ztest, Up: Top
|
||||
|
||||
9 Zupdate
|
||||
*********
|
||||
|
@ -843,13 +851,24 @@ compressor can't be run, or comparison fails).
|
|||
'--destdir=DIR'
|
||||
Write recompressed files to another directory, using DIR as base
|
||||
directory, instead of writing them in the same directory as the
|
||||
original files. In recursive mode, this is done by replacing each
|
||||
directory specified in the command line with DIR to produce the
|
||||
recompressed file names. For example, 'zupdate -r -d DIR ../a'
|
||||
recompresses a file named '../a/b/c.gz' to 'DIR/b/c.lz'. Regular files
|
||||
specified in the command line are recompressed directly into DIR. For
|
||||
example, 'zupdate -d DIR ../a/b/c.gz' writes the recompressed file to
|
||||
'DIR/c.lz'.
|
||||
original files. This is done by removing the (possibly empty) prefix
|
||||
preceding the last slash (if any) of each FILE specified in the
|
||||
command line, and then prepending DIR to produce the recompressed file
|
||||
names.
|
||||
|
||||
In recursive mode, if FILE ends with a slash and names a directory, it
|
||||
is completely replaced with DIR. Therefore, if FILE ends with a slash,
|
||||
all the files in FILE are recompressed directly into DIR, but if FILE
|
||||
does not end with a slash, the files in FILE are recompressed into the
|
||||
subdirectory DIR/`basename( FILE )`. 'FILE/' is thus equivalent to
|
||||
'FILE/*', but without the danger of exceeding the length limit of the
|
||||
command line.
|
||||
|
||||
For example, 'zupdate -r -d DIR ../a' recompresses the file
|
||||
'../a/b.gz' to 'DIR/a/b.lz', while 'zupdate -r -d DIR ../a/'
|
||||
recompresses the same file to 'DIR/b.lz'. Regular files specified in
|
||||
the command line are recompressed directly into DIR. For example,
|
||||
'zupdate -d DIR ../a/b.gz' writes the recompressed file to 'DIR/b.lz'.
|
||||
|
||||
This option allows recompressing files from a read-only file system to
|
||||
another place without the need to copy or link them to the destination
|
||||
|
@ -925,9 +944,56 @@ compressor can't be run, or comparison fails).
|
|||
|
||||
|
||||
|
||||
File: zutils.info, Node: Problems, Next: Concept index, Prev: Zupdate, Up: Top
|
||||
File: zutils.info, Node: Argument syntax, Next: Problems, Prev: Zupdate, Up: Top
|
||||
|
||||
10 Reporting bugs
|
||||
10 Syntax of command-line arguments
|
||||
***********************************
|
||||
|
||||
POSIX recommends these conventions for command-line arguments.
|
||||
|
||||
* A command-line argument is an option if it begins with a hyphen ('-').
|
||||
|
||||
* Option names are single alphanumeric characters.
|
||||
|
||||
* Certain options require an argument.
|
||||
|
||||
* An option and its argument may or may not appear as separate tokens.
|
||||
(In other words, the whitespace separating them is optional). Thus,
|
||||
'-o foo' and '-ofoo' are equivalent.
|
||||
|
||||
* One or more options without arguments, followed by at most one option
|
||||
that takes an argument, may follow a hyphen in a single token. Thus,
|
||||
'-abc' is equivalent to '-a -b -c'.
|
||||
|
||||
* Options typically precede other non-option arguments.
|
||||
|
||||
* The argument '--' terminates all options; any following arguments are
|
||||
treated as non-option arguments, even if they begin with a hyphen.
|
||||
|
||||
* A token consisting of a single hyphen character is interpreted as an
|
||||
ordinary non-option argument. By convention, it is used to specify
|
||||
standard input, standard output, or a file named '-'.
|
||||
|
||||
GNU adds "long options" to these conventions:
|
||||
|
||||
* A long option consists of two hyphens ('--') followed by a name made
|
||||
of alphanumeric characters and hyphens. Option names are typically one
|
||||
to three words long, with hyphens to separate words. Abbreviations can
|
||||
be used for the long option names as long as the abbreviations are
|
||||
unique.
|
||||
|
||||
* A long option and its argument may or may not appear as separate
|
||||
tokens. In the latter case they must be separated by an equal sign '='.
|
||||
Thus, '--foo bar' and '--foo=bar' are equivalent.
|
||||
|
||||
The syntax of options with an optional argument is
|
||||
'-<short_option><argument>' (without whitespace), or
|
||||
'--<long_option>=<argument>'.
|
||||
|
||||
|
||||
File: zutils.info, Node: Problems, Next: Concept index, Prev: Argument syntax, Up: Top
|
||||
|
||||
11 Reporting bugs
|
||||
*****************
|
||||
|
||||
There are probably bugs in zutils. There are certainly errors and omissions
|
||||
|
@ -948,6 +1014,7 @@ Concept index
|
|||
|