mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
find: Allow '/' to be used with -perm for GNU compatibility
In 2005, Gnu find deprecated '+' as the leading character for the -perm argument, instead preferring '/' with the same meaning. Implement that behavior here, and document it in the man page. Reviewed by: imp, emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1060
This commit is contained in:
parent
ec13a838e6
commit
2a121b97e9
|
@ -28,7 +28,7 @@
|
|||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd December 22, 2023
|
||||
.Dd January 15, 2024
|
||||
.Dt FIND 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -757,7 +757,7 @@ Slashes
|
|||
.Pq Dq Li /
|
||||
are treated as normal characters and do not have to be
|
||||
matched explicitly.
|
||||
.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode
|
||||
.It Ic -perm Oo Cm - Ns | Ns Cm + Ns | Ns Cm / Oc Ns Ar mode
|
||||
The
|
||||
.Ar mode
|
||||
may be either symbolic (see
|
||||
|
@ -786,11 +786,14 @@ are set in the file's mode bits.
|
|||
If the
|
||||
.Ar mode
|
||||
is preceded by a plus
|
||||
.Pq Dq Li + ,
|
||||
.Pq Dq Li +
|
||||
this primary evaluates to true
|
||||
if any of the bits in the
|
||||
.Ar mode
|
||||
are set in the file's mode bits.
|
||||
A slash
|
||||
.Pq Dq Li /
|
||||
is also accepted with the same meaning as plus for compatibility with GNU find.
|
||||
Otherwise, this primary evaluates to true if
|
||||
the bits in the
|
||||
.Ar mode
|
||||
|
@ -1116,6 +1119,16 @@ option was inspired by the equivalent
|
|||
and
|
||||
.Xr sed 1
|
||||
options.
|
||||
.Pp
|
||||
The
|
||||
.Ic -perm
|
||||
primary accepts a leading slash
|
||||
.Pq Dq Li /
|
||||
as an alias for a leading plus
|
||||
.Pq Dq Li +
|
||||
for its argument as an extension of
|
||||
.St -p1003.1-2001
|
||||
to be compatible with GNU find.
|
||||
.Sh HISTORY
|
||||
A simple
|
||||
.Nm
|
||||
|
|
|
@ -1338,7 +1338,7 @@ c_perm(OPTION *option, char ***argvp)
|
|||
if (*perm == '-') {
|
||||
new->flags |= F_ATLEAST;
|
||||
++perm;
|
||||
} else if (*perm == '+') {
|
||||
} else if (*perm == '+' || *perm == '/') {
|
||||
new->flags |= F_ANY;
|
||||
++perm;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue