summaryrefslogtreecommitdiffstats
path: root/parse.c
Commit message (Collapse)AuthorAgeFilesLines
* posix1e: Don't #include <sys/capability.h> on FreeBSDTavian Barnes2019-01-031-0/+1
| | | | | | | | The file is there by default, but deprecated and not a POSIX.1E implementation. While I'm at it, move the logic to posix1e.h so other files aren't burdened with an extra include. Fixes the other half of #40.
* color: Check format strings + args for cfprintf()Tavian Barnes2019-01-021-219/+221
| | | | | | %{cc} is now ${cc} to avoid warnings about an unrecognized format specifier, and %P and %L are now %pP and %pL to make them look more like standard format strings.
* diag: Unify diagnostic formattingTavian Barnes2019-01-021-67/+70
| | | | | | This adds a bfs: prefix to error/warning messages for consistency with other command line tools, and leaves only the "error:"/"warning:" part colored like GCC. It also uniformly adds full stops after messages.
* Hide unsupported options from -helpTavian Barnes2018-12-301-0/+6
|
* parse: Handle argc == 0Tavian Barnes2018-12-281-0/+6
| | | | | Linux allows you to exec() with no argument list at all. Default to "bfs" in that case.
* stat: Provide a helper for getting human-readable field namesTavian Barnes2018-12-251-37/+30
| | | | And fix -newerXY if the Y time doesn't exist.
* parse: Fix probabilities when -types are duplicatedTavian Barnes2018-12-191-16/+24
| | | | -type f,f does not have more than a 100% probability of success.
* parse: Add cost info for -acl and -capableTavian Barnes2018-12-191-2/+6
| | | | And set ephemeral_fds correctly too.
* Implement -acl testTavian Barnes2018-12-171-0/+19
|
* Add new -capable testTavian Barnes2018-12-171-0/+20
|
* parse: Use a better reference point for incomplete expression errorsTavian Barnes2018-11-021-1/+8
| | | | | This makes `bfs -not type d` complain about nothing following the `-not` rather than the `d`.
* parse: Add support for -D all to enable all debug flagsTavian Barnes2018-11-021-0/+3
|
* parse: Improve -D diagnosticsTavian Barnes2018-11-021-12/+26
|
* Update copyright datesTavian Barnes2018-09-241-1/+1
|
* Add some missing fallthrough commentsTavian Barnes2018-08-161-0/+1
|
* parse: Add some missing failure messagesTavian Barnes2018-07-061-0/+2
|
* parse: Don't leave expr->mode_cmp uninitializedTavian Barnes2018-06-181-1/+1
| | | | | | | | | When adding support for -perm +7777, I introduced an unconditional break that should have been conditional. The bug was observable with $ ./tests.sh --verbose --bfs="valgrind $PWD/bfs" test_perm_leading_plus_symbolic Fixes: 7f8bacca4c2b1d35bb65ddf8cbf70fadf1adf66e
* printf: Add %w and %Wk for file birth timesTavian Barnes2018-01-201-1/+6
| | | | | %w and %W were chosen to match the format specifiers for file birth times from stat(1)
* stat: New wrapper around the stat() familyTavian Barnes2018-01-081-64/+45
| | | | | This lets bfs transparently support the new statx() system call on Linux, giving it access to file birth times.
* parse: Minor cleanups from af7878c/7da0d28Tavian Barnes2018-01-061-6/+2
|
* Keep track of required FDs per-exprTavian Barnes2017-12-151-11/+14
|
* color: Implement %m for cfprintf()Tavian Barnes2017-11-131-6/+6
|
* exec: Recover from E2BIGTavian Barnes2017-11-121-2/+6
|
* cmdline: Account for files opened during/between evaluations more carefullyTavian Barnes2017-11-121-7/+21
|
* Add support for file birth/creation times on platforms that have itTavian Barnes2017-11-051-34/+71
| | | | Fixes #19
* parse: Support -perm +7777, for compatibility with BSD and old GNU findTavian Barnes2017-11-051-0/+6
|
* parse: Keep track of what files are already openTavian Barnes2017-10-211-40/+99
| | | | Fixes #22
* Report errors that occur when closing filesTavian Barnes2017-10-211-7/+30
| | | | Otherwise we miss write errors that occur when flushing the cache.
* Add a man pageTavian Barnes2017-10-151-15/+22
| | | | Fixes #31
* parse: Document the bfs meaning of -O in -helpTavian Barnes2017-09-171-2/+15
|
* opt: Separate optimization from parsingTavian Barnes2017-09-161-328/+19
|
* parse: Don't reorder or remove tests with potential side effectsTavian Barnes2017-09-061-3/+21
| | | | | | -empty and -xtype may have side effects like reporting permission errors, which even affect the exit status of bfs. We shouldn't remove these effects without -Ofast.
* parse: Factor out common initialization code for -print and friendsTavian Barnes2017-09-061-35/+30
|
* Implement -D searchTavian Barnes2017-09-021-0/+3
|
* Implement cost-based optimizationTavian Barnes2017-08-271-43/+210
|
* Avoid multiple extra stat()s of broken symlinks for -xtypeTavian Barnes2017-08-221-1/+1
|
* Unify broken symlink handlingTavian Barnes2017-08-121-1/+1
| | | | | | | | | 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.
* parse: Don't allow negative optimization levelsTavian Barnes2017-08-101-1/+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-29/+31
| | | | | | | | | | 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.
* Fix a couple terrible optimizer bugsTavian Barnes2017-07-211-2/+2
| | | | | | | Just because an expression is always true or false, doesn't mean we can execute it more often than it otherwise would be, unless it's also pure. But that's equivalent to being identically -true/-false, so just check that.
* Implement -printxTavian Barnes2017-07-211-0/+16
| | | | Also from NetBSD.
* Implement -exit [STATUS]Tavian Barnes2017-07-201-0/+23
| | | | From NetBSD again.
* Implement -rm as an alias for -deleteTavian Barnes2017-07-201-0/+4
| | | | From NetBSD.
* parse: Ask for confirmation in some casesTavian Barnes2017-07-161-108/+154
|
* parse: Warn if -depth and -prune are used togetherTavian Barnes2017-07-091-0/+19
|
* -perm: Handle permcopy (e.g. u=rw,g=u) correctlyTavian Barnes2017-06-151-5/+16
|
* parse: Make some error messages redTavian Barnes2017-06-031-2/+4
|
* parse: Set always_true for some actions that never return falseTavian Barnes2017-05-171-3/+25
|
* Add colors to -D treeTavian Barnes2017-05-151-37/+44
|