summaryrefslogtreecommitdiffstats
path: root/color.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't truncate files until we know they're not duplicatesTavian Barnes2021-09-261-37/+2
|
* 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.
* color: Fix a leak on unknown color keysTavian Barnes2021-06-161-2/+7
| | | | Previously reproducible with LS_COLORS="asdf=0" bfs.
* bftw: Fix bftw_type() for broken links and BFS_STAT_FOLLOWTavian Barnes2021-03-101-8/+5
| | | | This fixes link target coloring for broken links with -L.
* Update copyright datesTavian Barnes2021-02-051-1/+1
|
* dir: New DIR* facadeTavian Barnes2021-01-281-12/+13
|
* Give messages to unconditional assertion failuresTavian Barnes2020-12-021-1/+1
|
* color: Add an intermediate bufferTavian Barnes2020-11-281-68/+102
| | | | | | | cfprintf() on an unbuffered file like stderr was causing a lot of write() calls since every format specifier resulted in a separate fwrite(). This led to inefficiency and bad interleaving. Add our own dstring buffer to smooth it out.
* Include what I useTavian Barnes2020-11-121-1/+2
| | | | 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
|
* stat: Rename bfs_stat_flag to _flagsTavian Barnes2020-09-181-5/+5
| | | | Flags enums should be plural.
* Don't call stat() just to determine symbolic lengthsTavian Barnes2020-09-181-5/+2
| | | | | | | 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.
* bftw: Rename bftw_typeflag to bftw_type, and make it not a bitmaskTavian Barnes2020-07-291-5/+5
|
* diag: Unify debug printingTavian Barnes2020-06-021-0/+71
|
* parse: Prettify some errors and warningsTavian Barnes2020-03-201-1/+1
|
* color: Actually resolve symlinks against their parent directoryTavian Barnes2019-09-041-1/+1
|
* color: Fix unsigned < 0 comparisonTavian Barnes2019-09-031-1/+1
|
* color: Fix directory coloring when resolving symlinks at the rootTavian Barnes2019-09-031-27/+42
|
* color: Color leading directories as errors if they don't existTavian Barnes2019-08-231-5/+74
| | | | Fixes #51.
* color: Fix a crash if LS_COLORS ends in *Tavian Barnes2019-06-271-5/+10
|
* color: Fix a crash if strndup() failsTavian Barnes2019-06-271-5/+5
|
* fsade: Refactor the POSIX.1e abstractionsTavian Barnes2019-05-241-2/+2
| | | | | | | 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.
* color: Don't stat() if we don't need toTavian Barnes2019-05-051-26/+44
|
* bftw: Pass a const struct BFTW * to the callbackTavian Barnes2019-05-051-6/+6
|
* bftw: Add a caching stat() API to struct BFTWTavian Barnes2019-05-041-39/+30
|
* stat: Unify the flags argumentsTavian Barnes2019-05-041-5/+5
|
* trie: Make trie_remove() take a leaf instead of a keyTavian Barnes2019-04-201-3/+3
|
* color: Implement ln=targetTavian Barnes2019-03-281-18/+57
| | | | | With ln=target in LS_COLORS, links should be colored according to their target's stat() info, not their own.
* color: Implement escape sequence parsingTavian Barnes2019-03-281-196/+396
| | | | | GNU ls allows custom escape sequences inside color values, including control characters and embedded NULs.
* trie: Store void* values rather than const void*Tavian Barnes2019-03-271-1/+1
| | | | Fewer casts needed this way.
* color: Match the behaviour of GNU ls more closelyTavian Barnes2019-03-171-23/+19
|
* color: Use a trie to store file extension colorsTavian Barnes2019-03-041-48/+82
| | | | | This new implementation is about 14% faster overall at printing colored files.
* Add some documentation commentsTavian Barnes2019-02-091-0/+20
|
* color.c: Fix an out-of-bounds read if LS_COLORS doesn't end in a colonTavian Barnes2019-01-111-9/+9
|
* posix1e: Split out ACL and capability handling from utilTavian Barnes2019-01-021-0/+1
|
* color: Fix more incompatibilities with GNU lsTavian Barnes2019-01-021-14/+17
|
* color: Check format strings + args for cfprintf()Tavian Barnes2019-01-021-82/+105
| | | | | | %{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-23/+22
| | | | | | 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.
* color: Don't bail out on colors that exist but are NULLTavian Barnes2018-12-281-14/+7
|
* color: Support coloring files with capabilitiesTavian Barnes2018-12-171-0/+2
|
* color: Make extension detection case-insensitiveTavian Barnes2018-12-171-8/+18
| | | | It's what GNU ls does.
* color: Don't print the leading directory color if there's no leading directoryTavian Barnes2018-12-171-23/+22
|
* Update copyright datesTavian Barnes2018-09-241-1/+1
|
* stat: New wrapper around the stat() familyTavian Barnes2018-01-081-11/+12
| | | | | This lets bfs transparently support the new statx() system call on Linux, giving it access to file birth times.
* color: Optimize cfprintf() a bitTavian Barnes2017-11-131-76/+86
|
* color: Implement %m for cfprintf()Tavian Barnes2017-11-131-0/+7
|
* parse: Keep track of what files are already openTavian Barnes2017-10-211-2/+0
| | | | Fixes #22
* Report errors that occur when closing filesTavian Barnes2017-10-211-0/+2
| | | | Otherwise we miss write errors that occur when flushing the cache.
* util: Wrap faccessat() to fix some portability issuesTavian Barnes2017-09-201-1/+1
|
* Implement cost-based optimizationTavian Barnes2017-08-271-0/+16
|