jcs
/subtext
/amendments
/35
util: Remove strlc{at,py}, moved to new C library
jcs made amendment 35 over 2 years ago
--- util.c Tue Dec 14 14:54:42 2021
+++ util.c Mon Dec 20 21:35:17 2021
@@ -144,56 +144,6 @@ getline(char *str, size_t len, char **ret)
return 0;
}
-size_t
-strlcpy(char *dst, const char *src, size_t dsize)
-{
- const char *osrc = src;
- size_t nleft = dsize;
-
- if (nleft != 0) {
- while (--nleft != 0) {
- if ((*dst++ = *src++) == '\0')
- break;
- }
- }
-
- if (nleft == 0) {
- if (dsize != 0)
- *dst = '\0';
- while (*src++)
- ;
- }
-
- return (src - osrc - 1);
-}
-
-size_t
-strlcat(char *dst, const char *src, size_t dsize)
-{
- const char *odst = dst;
- const char *osrc = src;
- size_t n = dsize;
- size_t dlen;
-
- while (n-- != 0 && *dst != '\0')
- dst++;
- dlen = dst - odst;
- n = dsize - dlen;
-
- if (n-- == 0)
- return (dlen + strlen(src));
- while (*src != '\0') {
- if (n != 0) {
- *dst++ = *src;
- n--;
- }
- src++;
- }
- *dst = '\0';
-
- return (dlen + (src - osrc));
-}
-
const char *
ordinal(unsigned short n)
{