summaryrefslogtreecommitdiffstats
path: root/eval.c
Commit message (Collapse)AuthorAgeFilesLines
* printf: Take a CFILE, not a FILETavian Barnes2021-10-091-1/+1
|
* eval: Remove an extra space from -ls outputTavian Barnes2021-09-021-1/+1
|
* eval: Use 512-byte blocks for -ls when POSIXLY_CORRECT is setTavian Barnes2021-09-021-1/+2
| | | | | This matches the behaviour of GNU find, and allows bfs to match the output of BSD find as well. Fixes #77.
* util: Rename fallthrough to BFS_FALLTHROUGHTavian Barnes2021-06-091-2/+2
| | | | This avoids shadowing the actually standard name fallthrough.
* Implement time units for -{a,B,c,m}timeTavian Barnes2021-06-021-3/+5
| | | | From FreeBSD find. Closes #75.
* eval: Raise RLIMIT_NOFILE if possibleTavian Barnes2021-05-201-11/+37
| | | | | | This lets us keep more open FDs cached in bftw(). The limit is lowered before running -exec commands, in case they're incompatible with a high limit (e.g. due to select()).
* Use `<< {10,20,...}` instead of `*1024*1024...`Tavian Barnes2021-05-201-5/+5
|
* Implement -flags, from FreeBSD findTavian Barnes2021-03-061-0/+34
| | | | This is the last BSD-specific primary I'm aware of. Fixes #14.
* eval: Set the exit status automatically in eval_error()Tavian Barnes2021-03-061-5/+3
|
* Update copyright datesTavian Barnes2021-02-051-1/+1
|
* dir: New DIR* facadeTavian Barnes2021-01-281-58/+50
|
* Enable -Wshadow by defaultTavian Barnes2021-01-281-10/+10
| | | | And fix the one case it warns on.
* -used: Make the implementation match the GNU fixes for findutils 4.8.0Tavian Barnes2021-01-131-2/+7
|
* eval: Make -hidden behave consistentlyTavian Barnes2020-11-281-1/+8
| | | | | | | | | | | | | | | Previously there was an unexpected difference between $ bfs .hidden -hidden and $ bfs ./.hidden -hidden ./.hidden The intent of the code was to avoid considering `.`, the default starting point, as hidden and thus pruning a whole search with -nohidden. Fix it to do that explicitly, and handle `..` too.
* Include what I useTavian Barnes2020-11-121-0/+2
| | | | Thanks to https://github.com/include-what-you-use/include-what-you-use
* Use two newlines for all pre-eval warningsTavian Barnes2020-11-091-1/+1
|
* eval: Fix the status bar to only print the parent againTavian Barnes2020-11-041-5/+7
|
* eval: Make a crude attempt to handle double-width chars in the status barTavian Barnes2020-11-041-11/+49
|
* Enable -Wsign-compare to catch bugs like 726d7801Tavian Barnes2020-11-041-5/+5
|
* New -status option to display a status barTavian Barnes2020-11-031-11/+100
|
* expr, eval: Clean up header dependenciesTavian Barnes2020-10-061-0/+1
|
* diag: New bfs_perror() functionTavian Barnes2020-10-051-6/+6
|
* util: Don't rely on bftwTavian Barnes2020-09-301-1/+1
| | | | And rename format_mode() to xstrmode() while I'm at it.
* Rename struct cmdline to bfs_ctxTavian Barnes2020-09-271-66/+80
| | | | | The API remains similar, with some added accessor functions for lazy initialization of the pwcache and mtab.
* stat: Rename bfs_stat_flag to _flagsTavian Barnes2020-09-181-2/+2
| | | | Flags enums should be plural.
* Don't call stat() just to determine symbolic lengthsTavian Barnes2020-09-181-5/+3
| | | | | | | The new bftw_cached_stat() helper gets us stat info if we already have it, but doesn't call stat() if we don't. In that case we just take a guess for the initial length to readlinkat(). This lets us avoid stat() entirely in many cases for -lname and -printf %l.
* Implement -xattrnameTavian Barnes2020-08-131-0/+13
| | | | From macOS find.
* bftw: Make some flag names more explicitTavian Barnes2020-07-291-6/+6
|
* bftw: Rename bftw_typeflag to bftw_type, and make it not a bitmaskTavian Barnes2020-07-291-37/+35
|
* eval: Fix an assertion failure with -D search -sTavian Barnes2020-06-161-0/+1
|
* eval: Fix a segfault with -D search -S edsTavian Barnes2020-06-161-0/+1
|
* Treat -nohidden like -exclude -hiddenTavian Barnes2020-06-071-12/+0
| | | | Fixes #30.
* Implement -exclude, a special form for convenient exclusionsTavian Barnes2020-06-071-0/+5
| | | | Fixes #8.
* diag: Unify debug printingTavian Barnes2020-06-021-14/+14
|
* pwcache: Rename from passwd.[ch]Tavian Barnes2020-04-221-1/+1
|
* passwd: Cache the user/group tablesTavian Barnes2020-02-291-22/+7
| | | | | | | | | | | | | | | | | | | | | | This is a significant optimization for conditions that need these tables: Benchmark #1: ./bfs ~/code/linux -nouser >/dev/null Time (mean ± σ): 232.0 ms ± 2.5 ms [User: 44.3 ms, System: 185.0 ms] Range (min … max): 228.7 ms … 238.7 ms 12 runs Benchmark #2: ./bfs-1.6 ~/code/linux -nouser >/dev/null Time (mean ± σ): 1.050 s ± 0.012 s [User: 544.2 ms, System: 500.0 ms] Range (min … max): 1.025 s … 1.063 s 10 runs Benchmark #3: find ~/code/linux -nouser >/dev/null Time (mean ± σ): 1.040 s ± 0.012 s [User: 533.6 ms, System: 500.6 ms] Range (min … max): 1.017 s … 1.054 s 10 runs Summary './bfs ~/code/linux -nouser >/dev/null' ran 4.48 ± 0.07 times faster than 'find ~/code/linux -nouser >/dev/null' 4.52 ± 0.07 times faster than './bfs-1.6 ~/code/linux -nouser >/dev/null'
* eval: Irregular files aren't emptyTavian Barnes2020-02-141-1/+1
| | | | | GNU find's -empty returns false for devices, sockets, etc., even though their st_size is 0. Match that behaviour.
* time: Split out time-related functions from utilTavian Barnes2020-02-131-0/+1
|
* Update copyright datesTavian Barnes2020-01-071-1/+1
|
* eval: For -ls, print a + if a file has ACLsTavian Barnes2020-01-071-1/+2
|
* darray: New dynamic array libraryTavian Barnes2019-08-291-1/+2
|
* Make -mount and -xdev do different thingsTavian Barnes2019-07-041-0/+1
| | | | | | | | | POSIX now says -mount should skip the whole mount point, while -xdev should only skip its descendents. C.f. http://austingroupbugs.net/view.php?id=1133 C.f. https://savannah.gnu.org/bugs/?42318 C.f. https://savannah.gnu.org/bugs/?54745
* bftw: Remove BFTW_SKIP_SIBLINGSTavian Barnes2019-06-251-7/+6
| | | | | It's not used by bfs, and it's difficult to support in all search strategies.
* util: Filter out . and .. in xreaddir()Tavian Barnes2019-06-251-25/+8
|
* eval: Get rid of a level of indirection for quitTavian Barnes2019-06-161-13/+10
|
* Implement an iterative deepening mode (-ids)Tavian Barnes2019-05-291-1/+2
|
* Implement a depth-first mode (-dfs)Tavian Barnes2019-05-281-1/+14
|
* bftw: Visit multiple roots breadth-firstTavian Barnes2019-05-281-36/+33
| | | | This makes `bfs a b` treat `a` and `b` as siblings.
* Implement -xattr predicateTavian Barnes2019-05-241-0/+13
|
* fsade: Refactor the POSIX.1e abstractionsTavian Barnes2019-05-241-3/+15
| | | | | | | Since we're going to want to abstract more things that aren't part of POSIX.1e (like xattrs) in a similar way, let's give this a more generic name. And while we're at it, give it some more precise error reporting, and add some tests.