summaryrefslogtreecommitdiffstats
path: root/parse.c
Commit message (Collapse)AuthorAgeFilesLines
* Source / Include Folder (#88)トトも2022-04-161-3959/+0
| | | Moved Source Files Into `src` Folder
* color: Support a separate $BFS_COLORS environment variableTavian Barnes2022-04-151-1/+1
|
* color: Use three-letter codes for warnings and errorsTavian Barnes2022-04-151-5/+5
| | | | No reason to potentially conflict with the two-letter codes GNU ls uses.
* opt: Use floats consistently for probabilities and costsTavian Barnes2022-03-271-2/+2
|
* parse.c: Use state->last_arg as the location for the expected )Tavian Barnes2022-03-271-16/+4
| | | | This lets us remove the special case for *argv == NULL.
* parse: Highlight command line errorsTavian Barnes2022-03-271-147/+299
|
* diag: New functions for highlighting command line argumentsTavian Barnes2022-03-271-6/+20
|
* opt: Warn about expressions we remove while optimizingTavian Barnes2022-03-261-0/+5
|
* parse: Stop warning for options after tests/actionsTavian Barnes2022-03-261-44/+7
| | | | | | | | | | | Part of the bfs design philosophy is to care less about the order of arguments. As such, there's no good reason to be warning-compatible with GNU find in this case. I don't even think things like this are confusing: bfs -print -color so why warn about it?
* expr: Store auxilliary data in a unionTavian Barnes2022-03-251-332/+325
| | | | And rename struct expr to bfs_expr.
* Don't shadow standard headersTavian Barnes2022-03-121-3/+3
| | | | | | | | | | | | | @italic on the AUR stated that bfs from the AUR fails to build on Manjaro. From the build log, it seems like <time.h> doesn't get included properly. I assume it's picking up ./time.h instead. I couldn't reproduce the build issue in the default configuration, but it does fail with EXTRA_CFLAGS="-I." which isn't good. So rename everything with an x prefix to stop clashing. Link: https://aur.archlinux.org/packages/bfs#comment-856102 Link: https://paste.rs/eqR
* parse: Check for globs with unescaped trailing backslashesTavian Barnes2022-02-281-2/+23
| | | | | | | | | | Both macOS and musl fail to fail on an unescaped backslash, so check for it ourselves. Link: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fnmatch.html Link: https://github.com/void-linux/void-packages/pull/35836 Link: https://www.openwall.com/lists/musl/2022/02/25/2 Link: https://www.austingroupbugs.net/view.php?id=806
* regex: Rework error handlingTavian Barnes2022-02-241-12/+13
|
* regex: Wrap the POSIX API in a facadeTavian Barnes2022-02-211-13/+4
|
* regex: Add support for emacs and grep typesTavian Barnes2022-02-041-8/+18
|
* parse: Add support for ed and sed regexesTavian Barnes2022-01-301-1/+6
| | | | They're apparently the same as POSIX basic regexes.
* Standardize WITH_* make variables for configuring dependenciesTavian Barnes2022-01-291-1/+1
|
* Simplifyingdata-man2022-01-241-6/+1
|
* Using Oniguruma library (optionally)data-man2022-01-241-1/+6
|
* util: New close() wrappers to check for EBADF and preserve errnoTavian Barnes2022-01-181-4/+4
|
* parse: Switch back to O_TRUNC from explicit ftruncate()Tavian Barnes2021-10-191-16/+7
| | | | | | | | O_TRUNC is not equivalent to an unconditional ftruncate(), e.g. for device files. This reverts the behaviour change from 78944c81, which was never released and is not supported in other find implementations.
* parse: Fix UAF + double-free when ftruncate() failsTavian Barnes2021-10-191-5/+8
|
* tests: Add tests for parsing invalid integersTavian Barnes2021-10-011-4/+20
| | | | And give some better error messages.
* Don't truncate files until we know they're not duplicatesTavian Barnes2021-09-261-13/+32
|
* util: New xfopen() utilityTavian Barnes2021-09-211-1/+1
| | | | | And use it to pass O_CLOEXEC to all FILE*'s, so the files opened for -fprint etc. don't get passed to the programs run by -exec etc.
* ctx: Also deduplicate the standard streamsTavian Barnes2021-09-211-2/+19
| | | | | | This fixes some potential missing output when the same file is used in a redirection and something like -fprint. The main benefit is smarter handling of /dev/stdout, which will now share the CFILE* with cout.
* Fix the order of -fprintf FILE FORMAT in the docsTavian Barnes2021-09-151-1/+1
|
* Implement -files0-from FILETavian Barnes2021-09-151-4/+89
| | | | | See https://savannah.gnu.org/bugs/?60383 for the development of the corresponding GNU find feature.
* eval: Use 512-byte blocks for -ls when POSIXLY_CORRECT is setTavian Barnes2021-09-021-1/+3
| | | | | This matches the behaviour of GNU find, and allows bfs to match the output of BSD find as well. Fixes #77.
* parse: More -help pager improvementsTavian Barnes2021-06-131-39/+24
| | | | | | | | | | If $PAGER is unset, we now try less if it exists, then fall back to more. Colors are only used if less is the used pager, since more on non-coreutils platforms doesn't always handle colors. Finally, less's configuration is given on the command line, which works better if the user has $LESS already set. Fixes https://github.com/tavianator/bfs/issues/76.
* util: Rename fallthrough to BFS_FALLTHROUGHTavian Barnes2021-06-091-9/+9
| | | | This avoids shadowing the actually standard name fallthrough.
* Implement time units for -{a,B,c,m}timeTavian Barnes2021-06-021-11/+84
| | | | From FreeBSD find. Closes #75.
* Enable -Wimplicit-fallthroughTavian Barnes2021-06-021-5/+5
|
* parse: launch_pager(): set the LESS environment variable if it is empty.Markus F.X.J. Oberhumer2021-04-141-7/+12
|
* parse: check if PAGER environment variable is empty.Markus F.X.J. Oberhumer2021-04-131-1/+1
|
* Support -flags on all the BSDsTavian Barnes2021-03-061-26/+9
|
* Implement -flags, from FreeBSD findTavian Barnes2021-03-061-0/+55
| | | | This is the last BSD-specific primary I'm aware of. Fixes #14.
* Update copyright datesTavian Barnes2021-02-051-1/+1
|
* dir: New DIR* facadeTavian Barnes2021-01-281-10/+11
|
* parse: Fix the token type of -nowarnTavian Barnes2021-01-241-1/+1
|
* -perm: Use +t instead of ug+tTavian Barnes2021-01-131-2/+4
| | | | | | | | | The chmod spec says that ug+t is unspecified, and only +t or a+t is guaranteed to actually set the sticky bit. In practice GNU tools respect o+t as well, but ignore u+t/g+t. Fix the implementation to match GNU, and only test the POSIX required parse.
* Give messages to unconditional assertion failuresTavian Barnes2020-12-021-1/+1
|
* parse: Clean up debug flag parsing/printingTavian Barnes2020-12-021-37/+22
|
* parse: Don't pass an uninitialized regex_t to regerror()Tavian Barnes2020-11-281-1/+1
|
* Include what I useTavian Barnes2020-11-121-4/+3
| | | | Thanks to https://github.com/include-what-you-use/include-what-you-use
* New -status option to display a status barTavian Barnes2020-11-031-3/+16
|
* exec: Adjust some calling conventionsTavian Barnes2020-10-061-3/+3
|
* printf: Adjust some calling conventionsTavian Barnes2020-10-061-3/+3
|
* diag: New bfs_perror() functionTavian Barnes2020-10-051-16/+23
|
* parse: Fail if -color is passed and the colors couldn't be parsedTavian Barnes2020-10-041-0/+10
|