summaryrefslogtreecommitdiffstats
path: root/util.c
Commit message (Collapse)AuthorAgeFilesLines
* util: New xfopen() utilityTavian Barnes2021-09-211-0/+45
| | | | | 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.
* util: Wrap getdelim() instead of open coding itTavian Barnes2021-09-151-27/+20
|
* util: New xconfstr() wrapperTavian Barnes2021-06-131-0/+19
|
* util: Tweak the safe read/write functionsTavian Barnes2021-04-151-40/+31
|
* util: add safe_read_all() and safe_write_all() functions.Markus F.X.J. Oberhumer2021-04-151-0/+35
|
* util: introduce safe versions of read & write that handle interruptedMarkus F.X.J. Oberhumer2021-04-151-0/+20
| | | | systems calls.
* util: Fix build on GNU HurdTavian Barnes2021-03-211-1/+1
| | | | | | | Hurd apparently #defines BSD, but doesn't profide strtofflags. So make all that code conditional on !__GNU__. Link: https://buildd.debian.org/status/fetch.php?pkg=bfs&arch=hurd-i386&ver=2.2-1&stamp=1615370700&raw=0
* Support -flags on all the BSDsTavian Barnes2021-03-061-0/+30
|
* Update copyright datesTavian Barnes2021-02-051-1/+1
|
* dir: New DIR* facadeTavian Barnes2021-01-281-18/+0
|
* util: Use fgetc(stdin) instead of getchar()Tavian Barnes2020-11-301-1/+1
| | | | | On FreeBSD the getchar() macro leads to (spurious?) msan uninitialized value errors. Call the fgetc() library function to work around it.
* Include what I useTavian Barnes2020-11-121-1/+1
| | | | Thanks to https://github.com/include-what-you-use/include-what-you-use
* Enable -Wsign-compare to catch bugs like 726d7801Tavian Barnes2020-11-041-1/+1
|
* util: Move redirect() and isopen() to main.cTavian Barnes2020-10-011-28/+0
|
* util: Don't rely on bftwTavian Barnes2020-09-301-37/+36
| | | | And rename format_mode() to xstrmode() while I'm at it.
* util: Make the initial allocation bigger for xreadlinkat()Tavian Barnes2020-09-181-1/+6
| | | | | | | | | Most symlinks are more than 1 character long, so rather than wasting time with 1, 2, 4, ... when we don't have a good guess for the length, start with a bigger one. Credit to https://twitter.com/RichFelker/status/1306321019108556806 for reminding me of this.
* bftw: Rename bftw_typeflag to bftw_type, and make it not a bitmaskTavian Barnes2020-07-291-1/+1
|
* time: Split out time-related functions from utilTavian Barnes2020-02-131-86/+0
|
* parse: Handle 1969-12-31T23:59:59ZTavian Barnes2020-02-131-3/+24
| | | | | mktime() returns -1 on error, but also for one second before the epoch. Compare the input against localtime(-1) to distinguish those cases.
* Implement explicit reference times (-newerXt)Tavian Barnes2020-02-111-0/+54
|
* Update copyright datesTavian Barnes2020-01-071-1/+1
|
* util: Support ports and whiteouts in format_mode()Tavian Barnes2020-01-071-3/+13
|
* util: Filter out . and .. in xreaddir()Tavian Barnes2019-06-251-6/+14
|
* Turn on -Wstrict-prototypesTavian Barnes2019-02-061-1/+1
|
* main: Fix closed standard stream handlingTavian Barnes2019-02-011-7/+3
| | | | | bfs >&- should complain about a missing file descriptor, rather than silently succeeding.
* posix1e: Split out ACL and capability handling from utilTavian Barnes2019-01-021-168/+0
|
* util: Don't leak an acl_t on non-POSIX.1e platformsTavian Barnes2018-12-191-1/+2
|
* util: Support systems that don't define the POSIX.1e ACL tag valuesTavian Barnes2018-12-181-0/+4
|
* Implement -acl testTavian Barnes2018-12-171-1/+71
|
* color: Support coloring files with capabilitiesTavian Barnes2018-12-171-0/+93
|
* bftw: Move bftw_typeflag conversion out of utilTavian Barnes2018-12-171-98/+1
| | | | Turns out incomplete enum types are a GNU C extension.
* Check for <sys/param.h> before including itTavian Barnes2018-11-081-3/+7
| | | | Fixes #38.
* util: Provide fallback implementations of makedev()/major()/minor()Tavian Barnes2018-11-021-0/+14
|
* util: Wrap __has_include()Tavian Barnes2018-11-011-1/+1
|
* Print device major/minor numbers for -lsTavian Barnes2018-11-011-0/+16
|
* Update copyright datesTavian Barnes2018-09-241-1/+1
|
* util: Preserve errno in pipe_cloexec()Tavian Barnes2018-07-241-0/+2
|
* util: macOS doesn't have pipe2()Tavian Barnes2018-07-241-1/+2
| | | | | | | The code was testing for BSD, since all the normal BSDs have it. But until recently, <sys/param.h> wasn't included, so BSD was undefined even on platforms that define it. Now that it is defined appropriately, exclude macOS specifically.
* stat: New wrapper around the stat() familyTavian Barnes2018-01-081-11/+0
| | | | | This lets bfs transparently support the new statx() system call on Linux, giving it access to file birth times.
* exec: Recover from E2BIGTavian Barnes2017-11-121-0/+18
|
* util: Wrap faccessat() to fix some portability issuesTavian Barnes2017-09-201-0/+14
|
* util: Factor out checks for nonexistent paths/broken linksTavian Barnes2017-09-061-1/+5
|
* Avoid multiple extra stat()s of broken symlinks for -xtypeTavian Barnes2017-08-221-5/+5
|
* Unify broken symlink handlingTavian Barnes2017-08-121-0/+11
| | | | | | | | | 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.
* Re-license under the BSD Zero Clause LicenseTavian Barnes2017-07-271-10/+15
|
* main: Call setlocale() at startup to use the system localeTavian Barnes2017-07-201-0/+10
|
* Handle yes/no prompts correctly according to the localeTavian Barnes2017-07-151-0/+72
|
* Release 1.01.0Tavian Barnes2017-04-241-1/+1
|
* Move bftw_typeflag converters to util.cTavian Barnes2017-04-081-1/+98
|
* Color link targets for -lsTavian Barnes2017-03-161-0/+15
| | | | Fixes #18.