top: some minor tweaks supporting long cmdline options
This darn patch began as 1 correction to an extraneous comma in the man document. Then, it grew to include an adjustment for a couple of additional man page things. After that, I figured I might as well tighten up logic dealing with those awful gaps in the getopt_long code. [ the error_exit mentioned in the associated comment ] [ will only be taken when '=' ends the argv vectors! ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
24bb9227ac
commit
271004bd0d
@ -293,8 +293,9 @@ as scalable columns and discussed under topic `3a. DESCRIPTIONS of Fields'.
|
|||||||
.\" ----------------------------------------------------------------------
|
.\" ----------------------------------------------------------------------
|
||||||
Mandatory\fI arguments\fR to long options are mandatory for short
|
Mandatory\fI arguments\fR to long options are mandatory for short
|
||||||
options too.
|
options too.
|
||||||
The equals sign can be used with either option form and whitespace
|
|
||||||
before and/or after the `=' is permitted.
|
Although not required, the equals sign can be used with either option
|
||||||
|
form and whitespace before and/or after the `=' is permitted.
|
||||||
|
|
||||||
.TP 3
|
.TP 3
|
||||||
\-\fBb\fR, \fB\-\-batch\fR
|
\-\fBb\fR, \fB\-\-batch\fR
|
||||||
@ -446,7 +447,7 @@ The `p', `U' and `u' \*(COs are mutually exclusive.
|
|||||||
|
|
||||||
.TP 3
|
.TP 3
|
||||||
\-\fBV\fR, \fB\-\-version\fR
|
\-\fBV\fR, \fB\-\-version\fR
|
||||||
Show library version, then quit.
|
Display version information, then quit.
|
||||||
|
|
||||||
.TP 3
|
.TP 3
|
||||||
\-\fBw\fR, \fB\-\-width\fR [=\fICOLUMNS\fR]
|
\-\fBw\fR, \fB\-\-width\fR [=\fICOLUMNS\fR]
|
||||||
@ -460,7 +461,7 @@ In normal display mode, when used without an argument \*(We will\fI attempt\fR
|
|||||||
to format output using the COLUMNS= and LINES= environment variables, if set.
|
to format output using the COLUMNS= and LINES= environment variables, if set.
|
||||||
With an argument, output width can only be decreased, not increased.
|
With an argument, output width can only be decreased, not increased.
|
||||||
Whether using environment variables or an argument with \-w, when\fI not\fR
|
Whether using environment variables or an argument with \-w, when\fI not\fR
|
||||||
in Batch mode actual, terminal dimensions can never be exceeded.
|
in Batch mode actual terminal dimensions can never be exceeded.
|
||||||
|
|
||||||
\*(NT Without the use of this \*(CO, output width is always based on the
|
\*(NT Without the use of this \*(CO, output width is always based on the
|
||||||
terminal at which \*(We was invoked whether or not in Batch mode.
|
terminal at which \*(We was invoked whether or not in Batch mode.
|
||||||
|
@ -4235,8 +4235,10 @@ static void parse_args (int argc, char **argv) {
|
|||||||
cp = argv[optind++];
|
cp = argv[optind++];
|
||||||
if (cp) {
|
if (cp) {
|
||||||
if (*cp == '=') ++cp;
|
if (*cp == '=') ++cp;
|
||||||
if (*cp == '\0' && optind < argc) cp = argv[optind++];
|
/* here, if we're actually accessing argv[argc], we'll rely on
|
||||||
if (!cp || *cp == '\0') error_exit(fmtmk(N_fmt(MISSING_args_fmt), ch));
|
the required NULL delimiter which yields an error_exit next */
|
||||||
|
if (*cp == '\0') cp = argv[optind++];
|
||||||
|
if (!cp) error_exit(fmtmk(N_fmt(MISSING_args_fmt), ch));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
|
Loading…
Reference in New Issue
Block a user