1994-05-27 12:33:43 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1990, 1993, 1994
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Cimarron D. Taylor of the University of California, Berkeley.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef lint
|
1997-11-28 15:48:08 +00:00
|
|
|
/*
|
1994-05-27 12:33:43 +00:00
|
|
|
static char sccsid[] = "@(#)option.c 8.2 (Berkeley) 4/16/94";
|
1997-11-28 15:48:08 +00:00
|
|
|
*/
|
1994-05-27 12:33:43 +00:00
|
|
|
#endif /* not lint */
|
2003-06-14 13:00:21 +00:00
|
|
|
|
2002-04-01 22:56:56 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
1994-05-27 12:33:43 +00:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
#include <err.h>
|
|
|
|
#include <fts.h>
|
2001-02-23 16:20:55 +00:00
|
|
|
#include <regex.h>
|
2009-12-13 03:14:06 +00:00
|
|
|
#include <stdio.h>
|
1994-05-27 12:33:43 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "find.h"
|
|
|
|
|
2002-03-20 10:32:05 +00:00
|
|
|
int typecompare(const void *, const void *);
|
2002-02-27 17:57:00 +00:00
|
|
|
|
1994-05-27 12:33:43 +00:00
|
|
|
/* NB: the following table must be sorted lexically. */
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
/* Options listed with C++ comments are in gnu find, but not our find */
|
1994-05-27 12:33:43 +00:00
|
|
|
static OPTION const options[] = {
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "!", c_simple, f_not, 0 },
|
|
|
|
{ "(", c_simple, f_openparen, 0 },
|
|
|
|
{ ")", c_simple, f_closeparen, 0 },
|
2006-04-05 23:06:11 +00:00
|
|
|
{ "-Bmin", c_Xmin, f_Xmin, F_TIME_B },
|
|
|
|
{ "-Bnewer", c_newer, f_newer, F_TIME_B },
|
|
|
|
{ "-Btime", c_Xtime, f_Xtime, F_TIME_B },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-a", c_and, NULL, 0 },
|
2004-04-03 17:10:04 +00:00
|
|
|
{ "-acl", c_acl, f_acl, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-amin", c_Xmin, f_Xmin, F_TIME_A },
|
|
|
|
{ "-and", c_and, NULL, 0 },
|
|
|
|
{ "-anewer", c_newer, f_newer, F_TIME_A },
|
|
|
|
{ "-atime", c_Xtime, f_Xtime, F_TIME_A },
|
|
|
|
{ "-cmin", c_Xmin, f_Xmin, F_TIME_C },
|
|
|
|
{ "-cnewer", c_newer, f_newer, F_TIME_C },
|
|
|
|
{ "-ctime", c_Xtime, f_Xtime, F_TIME_C },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-d", c_depth, f_depth, 0 },
|
|
|
|
// -daystart
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-delete", c_delete, f_delete, 0 },
|
2004-05-28 17:17:15 +00:00
|
|
|
{ "-depth", c_depth, f_depth, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-empty", c_empty, f_empty, 0 },
|
|
|
|
{ "-exec", c_exec, f_exec, 0 },
|
|
|
|
{ "-execdir", c_exec, f_exec, F_EXECDIR },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-false", c_simple, f_false, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-flags", c_flags, f_flags, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
// -fls
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-follow", c_follow, f_always_true, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
// -fprint
|
|
|
|
// -fprint0
|
|
|
|
// -fprintf
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-fstype", c_fstype, f_fstype, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-gid", c_group, f_group, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-group", c_group, f_group, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-ignore_readdir_race",c_simple, f_always_true,0 },
|
|
|
|
{ "-ilname", c_name, f_name, F_LINK | F_IGNCASE },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-iname", c_name, f_name, F_IGNCASE },
|
|
|
|
{ "-inum", c_inum, f_inum, 0 },
|
|
|
|
{ "-ipath", c_name, f_path, F_IGNCASE },
|
|
|
|
{ "-iregex", c_regex, f_regex, F_IGNCASE },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-iwholename",c_name, f_path, F_IGNCASE },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-links", c_links, f_links, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-lname", c_name, f_name, F_LINK },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-ls", c_ls, f_ls, 0 },
|
|
|
|
{ "-maxdepth", c_mXXdepth, f_always_true, F_MAXDEPTH },
|
|
|
|
{ "-mindepth", c_mXXdepth, f_always_true, 0 },
|
|
|
|
{ "-mmin", c_Xmin, f_Xmin, 0 },
|
|
|
|
{ "-mnewer", c_newer, f_newer, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-mount", c_xdev, f_always_true, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-mtime", c_Xtime, f_Xtime, 0 },
|
|
|
|
{ "-name", c_name, f_name, 0 },
|
|
|
|
{ "-newer", c_newer, f_newer, 0 },
|
2006-04-03 20:36:37 +00:00
|
|
|
{ "-newerBB", c_newer, f_newer, F_TIME_B | F_TIME2_B },
|
2006-04-05 23:06:11 +00:00
|
|
|
{ "-newerBa", c_newer, f_newer, F_TIME_B | F_TIME2_A },
|
2006-04-03 20:36:37 +00:00
|
|
|
{ "-newerBc", c_newer, f_newer, F_TIME_B | F_TIME2_C },
|
|
|
|
{ "-newerBm", c_newer, f_newer, F_TIME_B },
|
|
|
|
{ "-newerBt", c_newer, f_newer, F_TIME_B | F_TIME2_T },
|
2006-04-05 23:06:11 +00:00
|
|
|
{ "-neweraB", c_newer, f_newer, F_TIME_A | F_TIME2_B },
|
|
|
|
{ "-neweraa", c_newer, f_newer, F_TIME_A | F_TIME2_A },
|
|
|
|
{ "-newerac", c_newer, f_newer, F_TIME_A | F_TIME2_C },
|
|
|
|
{ "-neweram", c_newer, f_newer, F_TIME_A },
|
|
|
|
{ "-newerat", c_newer, f_newer, F_TIME_A | F_TIME2_T },
|
2006-04-03 20:36:37 +00:00
|
|
|
{ "-newercB", c_newer, f_newer, F_TIME_C | F_TIME2_B },
|
2006-04-05 23:06:11 +00:00
|
|
|
{ "-newerca", c_newer, f_newer, F_TIME_C | F_TIME2_A },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-newercc", c_newer, f_newer, F_TIME_C | F_TIME2_C },
|
|
|
|
{ "-newercm", c_newer, f_newer, F_TIME_C },
|
|
|
|
{ "-newerct", c_newer, f_newer, F_TIME_C | F_TIME2_T },
|
2006-04-03 20:36:37 +00:00
|
|
|
{ "-newermB", c_newer, f_newer, F_TIME2_B },
|
2006-04-05 23:06:11 +00:00
|
|
|
{ "-newerma", c_newer, f_newer, F_TIME2_A },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-newermc", c_newer, f_newer, F_TIME2_C },
|
|
|
|
{ "-newermm", c_newer, f_newer, 0 },
|
|
|
|
{ "-newermt", c_newer, f_newer, F_TIME2_T },
|
|
|
|
{ "-nogroup", c_nogroup, f_nogroup, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-noignore_readdir_race",c_simple, f_always_true,0 },
|
|
|
|
{ "-noleaf", c_simple, f_always_true, 0 },
|
2002-08-19 02:27:33 +00:00
|
|
|
{ "-not", c_simple, f_not, 0 },
|
2003-02-18 14:30:43 +00:00
|
|
|
{ "-nouser", c_nouser, f_nouser, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-o", c_simple, f_or, 0 },
|
|
|
|
{ "-ok", c_exec, f_exec, F_NEEDOK },
|
|
|
|
{ "-okdir", c_exec, f_exec, F_NEEDOK | F_EXECDIR },
|
|
|
|
{ "-or", c_simple, f_or, 0 },
|
|
|
|
{ "-path", c_name, f_path, 0 },
|
|
|
|
{ "-perm", c_perm, f_perm, 0 },
|
|
|
|
{ "-print", c_print, f_print, 0 },
|
|
|
|
{ "-print0", c_print, f_print0, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
// -printf
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-prune", c_simple, f_prune, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-quit", c_simple, f_quit, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-regex", c_regex, f_regex, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-samefile", c_samefile, f_inum, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-size", c_size, f_size, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-true", c_simple, f_always_true, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-type", c_type, f_type, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-uid", c_user, f_user, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-user", c_user, f_user, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
{ "-wholename", c_name, f_path, 0 },
|
2001-05-03 18:05:35 +00:00
|
|
|
{ "-xdev", c_xdev, f_always_true, 0 },
|
Implement a number of primaries present in GNU find, but not present
in our find.
The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)
Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.
Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)
[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.
[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.
2008-02-23 16:29:04 +00:00
|
|
|
// -xtype
|
1994-05-27 12:33:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* find_create --
|
|
|
|
* create a node corresponding to a command line argument.
|
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
* add create/process function pointers to node, so we can skip
|
|
|
|
* this switch stuff.
|
|
|
|
*/
|
|
|
|
PLAN *
|
2003-06-14 13:00:21 +00:00
|
|
|
find_create(char ***argvp)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2002-02-27 17:57:00 +00:00
|
|
|
OPTION *p;
|
1994-05-27 12:33:43 +00:00
|
|
|
PLAN *new;
|
|
|
|
char **argv;
|
|
|
|
|
|
|
|
argv = *argvp;
|
|
|
|
|
2002-02-27 17:57:00 +00:00
|
|
|
if ((p = lookup_option(*argv)) == NULL)
|
1994-05-27 12:33:43 +00:00
|
|
|
errx(1, "%s: unknown option", *argv);
|
|
|
|
++argv;
|
|
|
|
|
2001-05-03 18:05:35 +00:00
|
|
|
new = (p->create)(p, &argv);
|
1994-05-27 12:33:43 +00:00
|
|
|
*argvp = argv;
|
|
|
|
return (new);
|
|
|
|
}
|
|
|
|
|
2001-05-03 18:05:35 +00:00
|
|
|
OPTION *
|
2003-06-14 13:00:21 +00:00
|
|
|
lookup_option(const char *name)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
|
|
|
OPTION tmp;
|
|
|
|
|
|
|
|
tmp.name = name;
|
|
|
|
return ((OPTION *)bsearch(&tmp, options,
|
|
|
|
sizeof(options)/sizeof(OPTION), sizeof(OPTION), typecompare));
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2003-06-14 13:00:21 +00:00
|
|
|
typecompare(const void *a, const void *b)
|
1994-05-27 12:33:43 +00:00
|
|
|
{
|
2002-02-27 17:57:00 +00:00
|
|
|
return (strcmp(((const OPTION *)a)->name, ((const OPTION *)b)->name));
|
1994-05-27 12:33:43 +00:00
|
|
|
}
|