On 2025-09-18 15:40, Alejandro Colomar wrote:
I know you already have str_startswith() and str_endswith(). The issue with those is that they're limited to returning a bool. The pointers are quite useful, IME. And the reason we chose those names in the committee --originally, the proposal was for stpprefix() and strsuffix()-- is that those compacted names are usually avoided by users as they know libc is more likely to take those. Thus, there's less existing code that would conflict with those names. Plus, they're consistent with the rest of libc.
I can certainly see the C standard preferring names that are already reserved by the standard.
Not sure I like having bool variants that are trivial wrappers for the pointer variants, though. Life is already complicated enough.
As Bruno wrote str_startswith and str_endswith I'd value his opinion.
tty = stppfx(tty, "/dev/") ?: tty;
Is "?:" in the C standard now? I missed that.
