summaryrefslogtreecommitdiffstats
path: root/eval.c
Commit message (Collapse)AuthorAgeFilesLines
* Unify broken symlink handlingTavian Barnes2017-08-121-16/+6
| | | | | | | | | Rather than open-code the fallback logic for broken symlinks everywhere it's needed, introduce a new xfstatat() utility function that performs the fallback automatically. Using xfstatat() consistently fixes a few bugs, including cases where broken symlinks are given as arguments to predicates like -samefile.
* util: Define O_DIRECTORY to 0 if it's not already definedTavian Barnes2017-07-291-5/+1
|
* Re-license under the BSD Zero Clause LicenseTavian Barnes2017-07-271-10/+15
|
* Represent never returning as always_true && always_falseTavian Barnes2017-07-211-3/+6
| | | | | | | | | | Expressions that never return are vacuously always both true and false. Using this representation lets us take advantage of existing truth-based optimizations, which gets us optimizations of command lines like bfs -name foo -quit -print for free.
* Implement -printxTavian Barnes2017-07-211-0/+38
| | | | Also from NetBSD.
* eval: Add some sanity checksTavian Barnes2017-07-201-0/+6
|
* Implement -exit [STATUS]Tavian Barnes2017-07-201-9/+19
| | | | From NetBSD again.
* Handle ENOTDIR the same as ENOENTTavian Barnes2017-07-091-2/+2
| | | | | | For a/b/c, ENOTDIR is returned instead of ENOENT if a or b are not directories. Handle this uniformly when detecting broken symlinks, readdir races, etc.
* Pass AT_EACCESS to faccessat()Tavian Barnes2017-04-301-1/+1
| | | | | That's the form that actually answers the expected question ("can I open() this"), and the only form Hurd supports.
* Don't forget an access mode to openat() in -emptyTavian Barnes2017-04-301-1/+1
|
* Release 1.01.0Tavian Barnes2017-04-241-1/+1
|
* Implement -fstypeTavian Barnes2017-04-231-0/+14
| | | | Fixes #6!
* Implement -XTavian Barnes2017-04-161-0/+7
|
* Implement -exec/-execdir ... +Tavian Barnes2017-04-151-189/+15
|
* Move bftw_typeflag converters to util.cTavian Barnes2017-04-081-1/+1
|
* Color link targets for -lsTavian Barnes2017-03-161-7/+1
| | | | Fixes #18.
* Give struct expr a CFILE* instead of just a FILE*Tavian Barnes2017-03-161-36/+14
| | | | This unifies the behaviour of -print and -fprint /dev/stdout.
* Implement -ls and -flsTavian Barnes2017-03-111-0/+105
|
* Make a printf()-style API for colored messagesTavian Barnes2017-03-111-9/+7
|
* bftw: Make the nameoff of "///" point to "/"Tavian Barnes2017-02-091-8/+3
| | | | This simplifies a few things such as -name handling for ///.
* Don't close stdin for -ok or -okdirTavian Barnes2017-02-091-9/+0
| | | | Turns out it violates POSIX, even though GNU find does it.
* Add support for -x?type with multiple typesTavian Barnes2017-02-081-28/+2
| | | | This functionality is already part of GNU findutils git.
* Add some missing perror() callsTavian Barnes2017-02-071-20/+16
|
* Make -quit happen immediately, not at the end of the current expressionTavian Barnes2017-02-051-3/+31
|
* Implement -printf/-fprintfTavian Barnes2017-02-051-30/+47
| | | | | Based on a patch by Fangrui Song <i@maskray.me>. Closes #16.
* Implement -nouser and -nogroupTavian Barnes2017-02-041-0/+26
|
* Don't trust st_size when reading symlinksTavian Barnes2017-01-311-12/+1
| | | | | Linux /proc, for example, reports a st_size of 0 for everything. It's nice to be able to use -lname on them anyway.
* Simplify exec_chdir()Tavian Barnes2017-01-141-16/+10
| | | | | | The previous code recomputed the name offset for no reason, and had an embarrassing typo that was hypothetically a bug (`} if` instead of `} else if`).
* eval: Check that O_DIRECTORY is defined before using itTavian Barnes2017-01-021-1/+5
|
* Add tera and peta suffices for -sizeTavian Barnes2016-12-201-2/+4
|
* Implement -sparse from FreeBSD findTavian Barnes2016-12-201-0/+13
|
* Implement BSD find's -depth NTavian Barnes2016-12-181-0/+7
|
* Implement -regex, -iregex, and -regextype/-ETavian Barnes2016-12-181-0/+33
|
* Move portability code into util.hTavian Barnes2016-12-041-12/+0
|
* Allow // to be different from /Tavian Barnes2016-11-241-5/+4
| | | | | | POSIX says that // may be resolved in an implementation-defined way (generally, to access network shares). So don't use it in tests, and don't canonicalize it to '/' in -execdir.
* Don't pass AT_SYMLINK_NOFOLLOW to faccessat()Tavian Barnes2016-11-221-1/+1
| | | | It's an invalid flag for that call, and FreeBSD actually complains.
* bftw: Make bftw_flags more similar to fts() options.Tavian Barnes2016-11-211-2/+5
|
* Fix -execdir for /Tavian Barnes2016-11-211-5/+12
|
* Fix -execdir for root paths with no slashes.Tavian Barnes2016-11-211-1/+5
|
* Check for readdir() errors everywhere.Tavian Barnes2016-11-141-4/+16
|
* Don't try to -delete the current directory.Tavian Barnes2016-11-131-0/+5
|
* Redirect stdin from /dev/null for -ok and -okdir.Tavian Barnes2016-11-131-0/+10
|
* Implement -perm.Tavian Barnes2016-10-291-0/+31
|
* Implement -ignore_readdir_race.Tavian Barnes2016-10-241-17/+25
|
* Check for POSIX timers before using them.Tavian Barnes2016-10-241-5/+23
|
* Check for errors in -print and friends.Tavian Barnes2016-10-161-4/+18
|
* bftw: Add support for some exotic file types, where available.Tavian Barnes2016-10-021-1/+22
|
* Use a linked list to store the root paths.Tavian Barnes2016-07-131-2/+2
|
* Implement -D rates.Tavian Barnes2016-06-281-2/+45
|
* Use underscores.Tavian Barnes2016-06-191-8/+8
|