mirror of
https://github.com/opnsense/src.git
synced 2026-02-20 00:11:07 -05:00
Make GNU-compatible following case:
single '-' in command line and '-' (non-first) in options
This commit is contained in:
parent
761981e0e8
commit
3700175bf1
2 changed files with 27 additions and 23 deletions
|
|
@ -271,29 +271,29 @@ found in glibc-2.1.3:
|
|||
.\" .Ev POSIXLY_CORRECT
|
||||
.\" and stops at the first non-option.
|
||||
.\" .El
|
||||
.It
|
||||
Handling of
|
||||
.Ql -
|
||||
within the option string (not the first character):
|
||||
.Bl -tag -width ".Bx"
|
||||
.It Tn GNU
|
||||
treats a
|
||||
.Ql -
|
||||
on the command line as a non-argument.
|
||||
.It Bx
|
||||
a
|
||||
.Ql -
|
||||
within the option string matches a
|
||||
.Ql -
|
||||
(single dash) on the command line.
|
||||
This functionality is provided for backward compatibility with
|
||||
programs, such as
|
||||
.Xr su 1 ,
|
||||
that use
|
||||
.Ql -
|
||||
as an option flag.
|
||||
This practice is wrong, and should not be used in any current development.
|
||||
.El
|
||||
.\" .It
|
||||
.\" Handling of
|
||||
.\" .Ql -
|
||||
.\" within the option string (not the first character):
|
||||
.\" .Bl -tag -width ".Bx"
|
||||
.\" .It Tn GNU
|
||||
.\" treats a
|
||||
.\" .Ql -
|
||||
.\" on the command line as a non-argument.
|
||||
.\" .It Bx
|
||||
.\" a
|
||||
.\" .Ql -
|
||||
.\" within the option string matches a
|
||||
.\" .Ql -
|
||||
.\" (single dash) on the command line.
|
||||
.\" This functionality is provided for backward compatibility with
|
||||
.\" programs, such as
|
||||
.\" .Xr su 1 ,
|
||||
.\" that use
|
||||
.\" .Ql -
|
||||
.\" as an option flag.
|
||||
.\" This practice is wrong, and should not be used in any current development.
|
||||
.\" .El
|
||||
.\" .It
|
||||
.\" Handling of
|
||||
.\" .Ql ::
|
||||
|
|
|
|||
|
|
@ -413,7 +413,11 @@ start:
|
|||
return (-1);
|
||||
}
|
||||
if (*(place = nargv[optind]) != '-' ||
|
||||
#ifdef GNU_COMPATIBLE
|
||||
place[1] == '\0') {
|
||||
#else
|
||||
(place[1] == '\0' && strchr(options, '-') == NULL)) {
|
||||
#endif
|
||||
place = EMSG; /* found non-option */
|
||||
if (flags & FLAG_ALLARGS) {
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue