3 ms·
strlcpy is a BSD-ism that isn't in posix. The official recommendation is stpecpy. Unfortunately, it is only implemented in the documentation, but not available
by manwe150 10mo ago
strlcpy is a BSD-ism that isn't in posix. The official recommendation is stpecpy. Unfortunately, it is only implemented in the documentation, but not available anywhere unless you roll your own:
https://man7.org/linux/man-pages/man7/string_copying.7.html https://man7.org/linux/man-pages/man7/string_copying.7.html
- tptacek 10mo agoWho cares? Just vendor it into your project. It's a tiny string manipulation function. (I agree with the author of the piece that strlcpy doesn't actually solve the real problem.)
- bentley 10mo agostrlcpy is in POSIX now, actually. https://pubs.opengroup.org/onlinepubs/9799919799/functions/strlcat.html https://pubs.opengroup.org/onlinepubs/9799919799/functions/s...
- manwe150 10mo agoAh, good point. I forgot it had just gotten added. Past context https://news.ycombinator.com/item?id=36765747 https://news.ycombinator.com/item?id=36765747