Hello,

this patch adds the -not operator to find(1).
I personally always found -not easier to use due to shell
escaping, but today may laziness has bitten back.
And "it's just one more non-POSIX-compliant option".

--steffen

Index: usr.bin/find/find.1
===================================================================
RCS file: /Users/steffen/arena/code.openbsd/src/usr.bin/find/find.1,v
retrieving revision 1.85
diff -a -p -u -r1.85 find.1
--- usr.bin/find/find.1 5 Jan 2012 13:16:10 -0000       1.85
+++ usr.bin/find/find.1 27 Feb 2012 18:11:14 -0000
@@ -520,6 +520,7 @@ This evaluates to true if the parenthesi
 true.
 .Pp
 .It Cm \&! Ar expression
+.It Cm -not Ar expression
 This is the unary
 .Tn NOT
 operator.
@@ -607,8 +608,8 @@ utility is compliant with the
 specification.
 .Pp
 The options
-.Op Fl dfhXx
-and primaries
+.Op Fl dfhXx ,
+primaries
 .Ic -amin ,
 .Ic -anewer ,
 .Ic -cmin ,
@@ -626,6 +627,8 @@ and primaries
 .Ic -mmin ,
 and
 .Ic -print0
+and the operator
+.Ic Cm -not
 are extensions to that specification.
 The
 .Ic -iname
Index: usr.bin/find/function.c
===================================================================
RCS file: /Users/steffen/arena/code.openbsd/src/usr.bin/find/function.c,v
retrieving revision 1.38
diff -a -p -u -r1.38 function.c
--- usr.bin/find/function.c     5 Jan 2012 10:21:33 -0000       1.38
+++ usr.bin/find/function.c     27 Feb 2012 17:58:28 -0000
@@ -1542,7 +1542,7 @@ c_closeparen(char *ignore, char ***ignor
 }
  
 /*
- * ! expression functions --
+ * ! expression/-not expression functions --
  *
  *     Negation of a primary; the unary NOT operator.
  */
Index: usr.bin/find/option.c
===================================================================
RCS file: /Users/steffen/arena/code.openbsd/src/usr.bin/find/option.c,v
retrieving revision 1.18
diff -a -p -u -r1.18 option.c
--- usr.bin/find/option.c       27 Oct 2009 23:59:38 -0000      1.18
+++ usr.bin/find/option.c       27 Feb 2012 17:57:45 -0000
@@ -79,6 +79,7 @@ static OPTION options[] = {
        { "-name",      N_NAME,         c_name,         O_ARGV },
        { "-newer",     N_NEWER,        c_newer,        O_ARGV },
        { "-nogroup",   N_NOGROUP,      c_nogroup,      O_ZERO },
+       { "-not",       N_NOT,          c_not,          O_ZERO },
        { "-nouser",    N_NOUSER,       c_nouser,       O_ZERO },
        { "-o",         N_OR,           c_or,           O_ZERO },
        { "-ok",        N_OK,           c_exec,         O_ARGVP },

Reply via email to