summaryrefslogtreecommitdiffstats
path: root/tests/bfstd.c
Commit message (Collapse)AuthorAgeFilesLines
* tests: Add ../src to the include pathTavian Barnes2024-04-191-3/+3
|
* bfstd: Escape ASCII tildesTavian Barnes2024-03-261-0/+2
| | | | | | | | The POSIX spec [1] lists some characters that may need to be escaped. Unfortunately, the document uses ˜ (U+02DC SMALL TILDE) instead of ~ (U+007E TILDE), and I copy-pasted from it. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02
* bfstd: New asciilen() functionTavian Barnes2024-03-211-0/+15
|
* bfstd: Check that wcwidth() is positiveTavian Barnes2024-03-201-0/+3
| | | | | wcwidth() returns -1 for non-printable characters, but terminals typically don't print anything for them, so treat them as 0.
* Re-run include-what-you-useTavian Barnes2024-03-111-3/+0
|
* xtime: Call tzset() from main() instead of lazilyTavian Barnes2024-03-071-5/+0
| | | | | | | | | | | | | POSIX specifies[1] that If a thread accesses tzname, daylight, or timezone directly while another thread is in a call to tzset(), or to any function that is required or allowed to set timezone information as if by calling tzset(), the behavior is undefined. So calling it lazily from arbitrary threads is risky. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tzset.html
* tests: New bfs_check() macroTavian Barnes2024-02-291-29/+36
| | | | | We now report failures and continue, rather than aborting after the first failure.
* tests: Merge unit test executables into oneTavian Barnes2024-01-121-2/+3
|
* bfstd: Add a thread-safe wrapper for strerror()Tavian Barnes2023-10-051-2/+2
|
* Formatting fixesTavian Barnes2023-09-271-1/+1
|
* bfstd: Fix printable_len() off-by-oneTavian Barnes2023-09-061-0/+15
| | | | | | | If xmbrtowc() fails, or if xiswprint() is false, then we shouldn't include that wide char in the printable length. Fixes: 19c96abe0a1ee56cf206fd5e87defb1fd3e0daa5
* bfstd: Fix an OOB string index in xmbrtowc()Tavian Barnes2023-09-061-0/+18
| | | | | | | | | | | | | | | | | | | | | | This bug could be reproduced with something like $ bfs -samefile $'\xFA\xFA' bfs: error: bfs: dstrnescat@src/dstring.c:252: wordesc() result truncated or worse, with -DNDEBUG, $ bfs -samefile $'.....................\xFA\xFA' bfs: error: bfs -samefile $'.....................\xFA\xFA\x00\x55\x53\x45\x52\x3D\x74\x61\x76\x69\x61\x6E\x61\x74\x6F\x72 bfs: error: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bfs: error: No such file or directory. which prints the memory after the end of the string (in this case, the environment variable USER=tavianator). The bug was caused by the line `*i += len`, which was intended to be `*i = len`. But actually, the right behaviour seems to be `*i += 1`. Fixes: 19c96abe0a1ee56cf206fd5e87defb1fd3e0daa5
* alloc: New header for memory allocation utilitiesTavian Barnes2023-06-201-11/+2
|
* tests/bfstd: Use bfs_verify() over explicit abort()Tavian Barnes2023-05-191-14/+5
|
* Switch from assert() to bfs_assert()/bfs_verify()Tavian Barnes2023-05-181-7/+6
|
* config: Align after saturating in flex_sizeof()Tavian Barnes2023-05-161-1/+2
| | | | | This ensures that it's legal to call aligned_alloc() with the result, which requires a multiple of the alignment.
* config: Saturate on overflow in flex_sizeof()Tavian Barnes2023-05-111-0/+1
|
* config: Properly align flex_sizeof()Tavian Barnes2023-05-111-0/+13
|
* Replace license boilerplate with SPDX tagsTavian Barnes2023-01-251-15/+2
| | | | | | | And while I'm at it, remove years from copyright declarations. Link: https://spdx.dev/about/ Link: https://daniel.haxx.se/blog/2023/01/08/copyright-without-years/
* bfstd: New wrappers for dirname()/basename()Tavian Barnes2023-01-191-0/+57