Sun Nov 1 05:38:29 2020 UTC ()
add support for '-not': GNU and thus worldly scripts compatibility.


(mrg)
diff -r1.27 -r1.28 src/usr.bin/find/option.c

cvs diff -r1.27 -r1.28 src/usr.bin/find/option.c (expand / switch to unified diff)

--- src/usr.bin/find/option.c 2016/06/13 00:04:40 1.27
+++ src/usr.bin/find/option.c 2020/11/01 05:38:29 1.28
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: option.c,v 1.27 2016/06/13 00:04:40 pgoyette Exp $ */ 1/* $NetBSD: option.c,v 1.28 2020/11/01 05:38:29 mrg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993, 1994 4 * Copyright (c) 1990, 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Cimarron D. Taylor of the University of California, Berkeley. 8 * Cimarron D. Taylor of the University of California, Berkeley.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36#ifndef lint 36#ifndef lint
37#if 0 37#if 0
38static char sccsid[] = "from: @(#)option.c 8.2 (Berkeley) 4/16/94"; 38static char sccsid[] = "from: @(#)option.c 8.2 (Berkeley) 4/16/94";
39#else 39#else
40__RCSID("$NetBSD: option.c,v 1.27 2016/06/13 00:04:40 pgoyette Exp $"); 40__RCSID("$NetBSD: option.c,v 1.28 2020/11/01 05:38:29 mrg Exp $");
41#endif 41#endif
42#endif /* not lint */ 42#endif /* not lint */
43 43
44#include <sys/types.h> 44#include <sys/types.h>
45#include <sys/stat.h> 45#include <sys/stat.h>
46 46
47#include <err.h> 47#include <err.h>
48#include <fts.h> 48#include <fts.h>
49#include <stdio.h> 49#include <stdio.h>
50#include <stdlib.h> 50#include <stdlib.h>
51#include <string.h> 51#include <string.h>
52 52
53#include "find.h" 53#include "find.h"
@@ -116,26 +116,28 @@ static OPTION const options[] = { @@ -116,26 +116,28 @@ static OPTION const options[] = {
116 { "-neweraB", N_UNIMPL, c_unimpl, 1 }, 116 { "-neweraB", N_UNIMPL, c_unimpl, 1 },
117 { "-newerac", N_UNIMPL, c_unimpl, 1 }, 117 { "-newerac", N_UNIMPL, c_unimpl, 1 },
118 { "-neweram", N_UNIMPL, c_unimpl, 1 }, 118 { "-neweram", N_UNIMPL, c_unimpl, 1 },
119 { "-newerca", N_UNIMPL, c_unimpl, 1 }, 119 { "-newerca", N_UNIMPL, c_unimpl, 1 },
120 { "-newercm", N_UNIMPL, c_unimpl, 1 }, 120 { "-newercm", N_UNIMPL, c_unimpl, 1 },
121 { "-newercB", N_UNIMPL, c_unimpl, 1 }, 121 { "-newercB", N_UNIMPL, c_unimpl, 1 },
122 { "-newermB", N_UNIMPL, c_unimpl, 1 }, 122 { "-newermB", N_UNIMPL, c_unimpl, 1 },
123 { "-newerma", N_UNIMPL, c_unimpl, 1 }, 123 { "-newerma", N_UNIMPL, c_unimpl, 1 },
124 { "-newermc", N_UNIMPL, c_unimpl, 1 }, 124 { "-newermc", N_UNIMPL, c_unimpl, 1 },
125 * 125 *
126 */ 126 */
127 127
128 { "-nogroup", N_NOGROUP, c_nogroup, 0 }, 128 { "-nogroup", N_NOGROUP, c_nogroup, 0 },
 129/* Alias for compatability with Gnu findutils */
 130 { "-not", N_NOT, c_not, 0 },
129 { "-nouser", N_NOUSER, c_nouser, 0 }, 131 { "-nouser", N_NOUSER, c_nouser, 0 },
130 { "-o", N_OR, c_or, 0 }, 132 { "-o", N_OR, c_or, 0 },
131 { "-ok", N_OK, c_exec, 1 }, 133 { "-ok", N_OK, c_exec, 1 },
132 { "-or", N_OR, c_or, 0 }, 134 { "-or", N_OR, c_or, 0 },
133 { "-path", N_PATH, c_path, 1 }, 135 { "-path", N_PATH, c_path, 1 },
134 { "-perm", N_PERM, c_perm, 1 }, 136 { "-perm", N_PERM, c_perm, 1 },
135 { "-print", N_PRINT, c_print, 0 }, 137 { "-print", N_PRINT, c_print, 0 },
136 { "-print0", N_PRINT0, c_print0, 0 }, 138 { "-print0", N_PRINT0, c_print0, 0 },
137 { "-printx", N_PRINTX, c_printx, 0 }, 139 { "-printx", N_PRINTX, c_printx, 0 },
138 { "-prune", N_PRUNE, c_prune, 0 }, 140 { "-prune", N_PRUNE, c_prune, 0 },
139 { "-regex", N_REGEX, c_regex, 1 }, 141 { "-regex", N_REGEX, c_regex, 1 },
140 { "-rm", N_DELETE, c_delete, 0 }, 142 { "-rm", N_DELETE, c_delete, 0 },
141 { "-since", N_SINCE, c_since, 1 }, 143 { "-since", N_SINCE, c_since, 1 },