aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/find
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/find')
-rw-r--r--usr.bin/find/find.14
-rw-r--r--usr.bin/find/find.h1
-rw-r--r--usr.bin/find/function.c5
3 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1
index d605e1986cac..cd51df3ac841 100644
--- a/usr.bin/find/find.1
+++ b/usr.bin/find/find.1
@@ -324,7 +324,9 @@ of the file's mode bits participate
in the comparison.
If the mode is preceded by a dash (``\-''), this primary evaluates to true
if at least all of the bits in the mode are set in the file's mode bits.
-If the mode is not preceded by a dash, this primary evaluates to true if
+If the mode is preceded by a plus (``\+''), this primary evaluates to true
+if any of the bits in the mode are set in the file's mode bits.
+Otherwise, this primary evaluates to true if
the bits in the mode exactly match the file's mode bits.
Note, the first character of a symbolic mode may not be a dash (``\-'').
.It Ic -flags Op Fl Ns Ar flags
diff --git a/usr.bin/find/find.h b/usr.bin/find/find.h
index b6e2eab86b6d..36a9193346e2 100644
--- a/usr.bin/find/find.h
+++ b/usr.bin/find/find.h
@@ -61,6 +61,7 @@ typedef struct _plandata {
#define F_MTFLAG 1 /* fstype */
#define F_MTTYPE 2
#define F_ATLEAST 1 /* perm */
+#define F_ANY 2 /* perm */
int flags; /* private flags */
enum ntype type; /* plan node type */
union {
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index 0dad26bb491c..b53f182c53ce 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -926,6 +926,8 @@ f_perm(plan, entry)
(S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO);
if (plan->flags == F_ATLEAST)
return ((plan->m_data | mode) == mode);
+ else if (plan->flags == F_ANY )
+ return (plan->m_data & mode);
else
return (mode == plan->m_data);
/* NOTREACHED */
@@ -945,6 +947,9 @@ c_perm(perm)
if (*perm == '-') {
new->flags = F_ATLEAST;
++perm;
+ } else if (*perm == '+') {
+ new->flags = F_ANY;
+ ++perm;
}
if ((set = setmode(perm)) == NULL)