summaryrefslogtreecommitdiffstats
path: root/parse.c
Commit message (Collapse)AuthorAgeFilesLines
* trie: Store void* values rather than const void*Tavian Barnes2019-03-271-2/+2
| | | | Fewer casts needed this way.
* bftw: Work around d_type being wrong for bind mounts on LinuxTavian Barnes2019-03-061-5/+8
| | | | | | C.f. https://savannah.gnu.org/bugs/?54913 C.f. https://lkml.org/lkml/2019/2/11/2027 Fixes https://github.com/tavianator/bfs/issues/37
* parse: Use a trie to hold currently open filesTavian Barnes2019-03-061-21/+18
|
* Implement -uniqueTavian Barnes2019-03-011-3/+23
| | | | Closes #48
* parse: Wrap -help output at 80 charsTavian Barnes2019-02-131-3/+4
|
* Fix missing color escape ($) in the -help outputTavian Barnes2019-02-121-1/+1
|
* Add some documentation commentsTavian Barnes2019-02-091-0/+7
|
* Re-write the help/manpageTavian Barnes2019-02-061-164/+125
| | | | | | I'm not sure people care very much whether the functionality they're looking up originated in POSIX/BSD/GNU find (and if they do, they can check those docs).
* parse: Treat -d as a flag, not an optionTavian Barnes2019-02-061-2/+2
| | | | | | This is consistent with BSD find, not with GNU find. But the GNU find feature was an (incorrect) attempt to be compatible with BSD find anyway.
* parse: Add support for whiteouts in -type/-xtypeTavian Barnes2019-02-061-0/+4
| | | | FreeBSD find supports this.
* Fix -nouser/-nogroup error handlingTavian Barnes2019-02-061-0/+2
| | | | | | | | | | The proper way to check for nonexistent users/groups is to set errno to 0 before the get{grg,pwu}id() call, and check it afterwards. On doing this, it becomes obvious that the call can fail if bftw() is using all the available FDs, so give them some ephemeral FDs. It would be ideal to read the user/group table only once, but this fixes the bug for now.
* parse: Remove the recommendation to check find -help or man findTavian Barnes2019-02-011-6/+3
| | | | bfs has had a comprehensive help text and man page for a while now.
* parse: Allow multiple comma-separated debug flagsTavian Barnes2019-01-111-46/+81
|
* 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.