aboutsummaryrefslogtreecommitdiffstats
path: root/src/string/str
diff options
context:
space:
mode:
Diffstat (limited to 'src/string/str')
-rw-r--r--src/string/str/stpncpy.c46
-rw-r--r--src/string/str/stpnmove.c47
-rw-r--r--src/string/str/strcncpy.c54
-rw-r--r--src/string/str/strcnmove.c54
-rw-r--r--src/string/str/strncasecmp.c50
-rw-r--r--src/string/str/strncasestr.c38
-rw-r--r--src/string/str/strncat.c43
-rw-r--r--src/string/str/strncmp.c39
-rw-r--r--src/string/str/strncpy.c43
-rw-r--r--src/string/str/strndup.c43
-rw-r--r--src/string/str/strnlen.c36
-rw-r--r--src/string/str/strnmove.c45
-rw-r--r--src/string/str/strnstr.c39
-rw-r--r--src/string/str/strstrncpy.c55
-rw-r--r--src/string/str/strstrnmove.c54
15 files changed, 0 insertions, 686 deletions
diff --git a/src/string/str/stpncpy.c b/src/string/str/stpncpy.c
deleted file mode 100644
index 876eaf0..0000000
--- a/src/string/str/stpncpy.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Copy a memory segment to another, non-overlapping, segment,
- * stop when a NUL byte is encountered.
- *
- * This is a GNU extension.
- *
- * @param whither The destination memory segment.
- * @param whence The source memory segment.
- * @param maxlen The maximum number of bytes to copy.
- * NOTE that if the resulting string at least this
- * long, no NUL byte will be written to `whither'.
- * On the otherhand, if the resultnig string is
- * shorter, `whither` will be filled with NUL bytes
- * until this amount of bytes have been written.
- * @return `whither` plus the number of written bytes,
- * excluding NUL bytes, is returned.
- */
-char* stpncpy(char* restrict whither, const char* restrict whence, size_t maxlen)
-{
- size_t n = strnlen(whence, maxlen);
- memcpy(whither, whence, n);
- memset(whither, 0, maxlen - n);
- return whither + n;
-}
-
diff --git a/src/string/str/stpnmove.c b/src/string/str/stpnmove.c
deleted file mode 100644
index a0a0de9..0000000
--- a/src/string/str/stpnmove.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Copy a memory segment to another, possibly overlapping, segment,
- * stop when a NUL byte is encountered.
- *
- * This is a slibc extension added for completeness.
- * It is only available if GNU extensions are available.
- *
- * @param whither The destination memory segment.
- * @param whence The source memory segment.
- * @param maxlen The maximum number of bytes to copy.
- * NOTE that if the resulting string at least this
- * long, no NUL byte will be written to `whither'.
- * On the otherhand, if the resultnig string is
- * shorter, `whither` will be filled with NUL bytes
- * until this amount of bytes have been written.
- * @return `whither` plus the number of written bytes,
- * excluding NUL bytes, is returned.
- */
-char* stpnmove(char* whither, const char* whence, size_t maxlen)
-{
- size_t n = strnlen(whence, maxlen);
- memmove(whither, whence, n);
- memset(whither, 0, maxlen - n);
- return whither + n;
-}
-
diff --git a/src/string/str/strcncpy.c b/src/string/str/strcncpy.c
deleted file mode 100644
index 5036c7d..0000000
--- a/src/string/str/strcncpy.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Copy a memory segment to another, non-overlapping, segment,
- * stop when a NUL byte or a specified byte is encountered.
- *
- * This is a slibc extension added for completeness.
- * It is only available if GNU extensions are available.
- *
- * @param whither The destination memory segment.
- * @param whence The source memory segment.
- * @param c The stop byte.
- * @param maxlen The maximum number of bytes to copy.
- * NOTE that if the resulting string at least this
- * long, no NUL byte will be written to `whither'.
- * On the otherhand, if the resultnig string is
- * shorter, `whither` will be filled with NUL bytes
- * until this amount of bytes have been written.
- * @return `NULL` if `c` was not encountered, otherwise
- * the position of `c` translated to `whither`,
- * that is, the address of `whither` plus the
- * number of copied characters; the address of
- * one character passed the last written non-NUL
- * character.
- */
-char* strcncpy(char* restrict whither, const char* restrict whence, int c, size_t maxlen)
-{
- const char* stop = memchr(whence, c, maxlen);
- size_t n = stop == NULL ? strnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
- memcpy(whither, whence, n);
- memset(whither, 0, maxlen - n);
- return r;
-}
-
diff --git a/src/string/str/strcnmove.c b/src/string/str/strcnmove.c
deleted file mode 100644
index f418e92..0000000
--- a/src/string/str/strcnmove.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Copy a memory segment to another, possibly overlapping, segment,
- * stop when a NUL byte or a specified byte is encountered.
- *
- * This is a slibc extension added for completeness.
- * It is only available if GNU extensions are available.
- *
- * @param whither The destination memory segment.
- * @param whence The source memory segment.
- * @param c The stop byte.
- * @param maxlen The maximum number of bytes to copy.
- * NOTE that if the resulting string at least this
- * long, no NUL byte will be written to `whither'.
- * On the otherhand, if the resultnig string is
- * shorter, `whither` will be filled with NUL bytes
- * until this amount of bytes have been written.
- * @return `NULL` if `c` was not encountered, otherwise
- * the position of `c` translated to `whither`,
- * that is, the address of `whither` plus the
- * number of copied characters; the address of
- * one character passed the last written non-NUL
- * character.
- */
-char* strcnmove(char* whither, const char* whence, int c, size_t maxlen)
-{
- const char* stop = memchr(whence, c, maxlen);
- size_t n = stop == NULL ? strnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
- memmove(whither, whence, n);
- memset(whither, 0, maxlen - n);
- return r;
-}
-
diff --git a/src/string/str/strncasecmp.c b/src/string/str/strncasecmp.c
deleted file mode 100644
index 919ff36..0000000
--- a/src/string/str/strncasecmp.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-#include <ctype.h>
-
-
-
-/**
- * Compare two strings alphabetically in a case insensitive manner.
- * Be aware, only ASCII characters are case insensitive, non-ASCII
- * characters are case sensitive.
- *
- * @param a A negative value is returned if this is the lesser.
- * @param b A positive value is returned if this is the lesser.
- * @param length The maximum number of characters to compare.
- * @return Zero is returned if `a` and `b` are equal, otherwise,
- * see the specifications for `a` and `b`.
- */
-int strncasecmp(const char* a, const char* b, size_t length)
-{
- int c1, c2;
- for (; length--; a++, b++)
- if (*a != *b)
- {
- c1 = isalpha(*a) ? tolower(*a) : (int)*a;
- c2 = isalpha(*b) ? tolower(*b) : (int)*b;
- if ((c1 -= c2))
- return c1;
- }
- else if (!*a && !*b) return 0;
- else if (!*a) return -1;
- else if (!*b) return +1;
- return 0;
-}
-
diff --git a/src/string/str/strncasestr.c b/src/string/str/strncasestr.c
deleted file mode 100644
index e95dc4b..0000000
--- a/src/string/str/strncasestr.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Finds the first occurrence of a substring.
- * This search is case insensitive.
- *
- * This is a slibc extension added for completeness.
- *
- * @param haystack The string to search.
- * @param needle The sought after substring.
- * @param maxlen The maximum number of character to search.
- * @return Pointer to the first occurrence of the
- * substring, `NULL` if not found.
- */
-char* (strncasestr)(const char* haystack, const char* needle, size_t maxlen)
-{
- return (memcasemem)(haystack, strnlen(haystack, maxlen), needle, strlen(needle));
-}
-
diff --git a/src/string/str/strncat.c b/src/string/str/strncat.c
deleted file mode 100644
index e7db0f2..0000000
--- a/src/string/str/strncat.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Concatenate a string to the end of another string.
- * The resulting strings must not overlap with the appended string.
- *
- * The use of this function is often a really bad idea.
- *
- * @param whither The string to extend.
- * @param whence The string to append.
- * @param maxlen The maximum number of bytes to copy.
- * NOTE that if the resulting string at least this
- * long, no NUL byte will be written to `whither'.
- * On the otherhand, if the resultnig string is
- * shorter, `whither` will be filled with NUL bytes
- * until this amount of bytes have been written.
- * @return `whither` is returned.
- */
-char* strncat(char* restrict whither, const char* restrict whence, size_t maxlen)
-{
- strncpy(whither + strlen(whither), whence, maxlen);
- return whither;
-}
-
diff --git a/src/string/str/strncmp.c b/src/string/str/strncmp.c
deleted file mode 100644
index daf5be5..0000000
--- a/src/string/str/strncmp.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Compare two strings alphabetically in a case sensitive manner.
- *
- * @param a A negative value is returned if this is the lesser.
- * @param b A positive value is returned if this is the lesser.
- * @param length The maximum number of characters to compare.
- * @return Zero is returned if `a` and `b` are equal, otherwise,
- * see the specifications for `a` and `b`.
- */
-int strncmp(const char* a, const char* b, size_t length)
-{
- size_t n = strnlen(a, length);
- size_t m = strnlen(b, length);
- int r = memcmp(a, b, (n < m ? n : m));
- return r ? r : n == m ? 0 : n < m ? -1 : +1;
-}
-
-
diff --git a/src/string/str/strncpy.c b/src/string/str/strncpy.c
deleted file mode 100644
index f3eba84..0000000
--- a/src/string/str/strncpy.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Copy a memory segment to another, non-overlapping, segment,
- * stop when a NUL byte is encountered.
- *
- * @param whither The destination memory segment.
- * @param whence The source memory segment.
- * @param maxlen The maximum number of bytes to copy.
- * NOTE that if the resulting string at least this
- * long, no NUL byte will be written to `whither'.
- * On the otherhand, if the resultnig string is
- * shorter, `whither` will be filled with NUL bytes
- * until this amount of bytes have been written.
- * @return `whither` is returned.
- */
-char* strncpy(char* restrict whither, const char* restrict whence, size_t maxlen)
-{
- size_t n = strnlen(whence, maxlen);
- memcpy(whither, whence, n);
- memset(whither, 0, maxlen - n);
- return whither;
-}
-
diff --git a/src/string/str/strndup.c b/src/string/str/strndup.c
deleted file mode 100644
index ca3b3f0..0000000
--- a/src/string/str/strndup.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-#include <stdlib.h>
-
-
-
-/**
- * Duplicate a string.
- *
- * This is a GNU extension.
- *
- * @param string The string to duplicate.
- * @param maxlen Truncate the string to this length, if it is longer.
- * A NUL byte is guaranteed to always be written
- * upon successful completion.
- * @return The new string. `NULL` is returned on error
- * and `errno` is set to indicate the error.
- *
- * @throws ENOMEM The process could not allocate sufficient amount of memory.
- */
-char* strndup(const char* string, size_t maxlen)
-{
- size_t n = strnlen(string, maxlen) + 1;
- char* r = malloc(n * sizeof(char));
- return r == NULL ? NULL : memcpy(r, string, n * sizeof(char));
-}
-
diff --git a/src/string/str/strnlen.c b/src/string/str/strnlen.c
deleted file mode 100644
index 5473682..0000000
--- a/src/string/str/strnlen.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Variant of `strlen` that only inspects the
- * beginning of a string.
- *
- * @param str The string.
- * @param maxlen The number of bytes to inspect, at most.
- * @return The number of bytes before, the first NUL byte.
- * `maxlen` if no NUL byte was found.
- */
-size_t strnlen(const char* str, size_t maxlen)
-{
- const char* end = memchr(str, 0, maxlen);
- return end == NULL ? maxlen : (size_t)(end - str);
-}
-
diff --git a/src/string/str/strnmove.c b/src/string/str/strnmove.c
deleted file mode 100644
index a8b3224..0000000
--- a/src/string/str/strnmove.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Copy a memory segment to another, possibly overlapping, segment,
- * stop when a NUL byte is encountered.
- *
- * This is a slibc extension added for completeness.
- *
- * @param whither The destination memory segment.
- * @param whence The source memory segment.
- * @param maxlen The maximum number of bytes to copy.
- * NOTE that if the resulting string at least this
- * long, no NUL byte will be written to `whither'.
- * On the otherhand, if the resultnig string is
- * shorter, `whither` will be filled with NUL bytes
- * until this amount of bytes have been written.
- * @return `whither` is returned.
- */
-char* strnmove(char* whither, const char* whence, size_t maxlen)
-{
- size_t n = strnlen(whence, maxlen);
- memmove(whither, whence, n);
- memset(whither, 0, maxlen - n);
- return whither;
-}
-
diff --git a/src/string/str/strnstr.c b/src/string/str/strnstr.c
deleted file mode 100644
index 8db61ac..0000000
--- a/src/string/str/strnstr.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Finds the first occurrence of a substring.
- * This search is case sensitive.
- *
- * This is a slibc extension added for because it was useful
- * in implementing slibc itself.
- *
- * @param haystack The string to search.
- * @param needle The sought after substring.
- * @param maxlen The maximum number of character to search.
- * @return Pointer to the first occurrence of the
- * substring, `NULL` if not found.
- */
-char* (strnstr)(const char* haystack, const char* needle, size_t maxlen)
-{
- return (memmem)(haystack, strnlen(haystack, maxlen), needle, strlen(needle));
-}
-
diff --git a/src/string/str/strstrncpy.c b/src/string/str/strstrncpy.c
deleted file mode 100644
index 0beb8ec..0000000
--- a/src/string/str/strstrncpy.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Copy a memory segment to another, non-overlapping, segment,
- * stop when a NUL byte or a specified substring is encountered.
- *
- * This is a slibc extension added for completeness.
- * It is only available if GNU extensions are available.
- *
- * @param whither The destination memory segment.
- * @param whence The source memory segment.
- * @param str The substring, ignored if `NULL`.
- * NOTE that if the resulting string at least this
- * long, no NUL byte will be written to `whither'.
- * On the otherhand, if the resultnig string is
- * shorter, `whither` will be filled with NUL bytes
- * until this amount of bytes have been written.
- * @param maxlen The maximum number of bytes to copy.
- * @return `NULL` if `str` was not encountered, otherwise
- * the position of `str` translated to `whither`,
- * that is, the address of `whither` plus the
- * number of copied characters; the address of
- * one character passed the last written non-NUL
- * character.
- */
-char* strstrncpy(char* restrict whither, const char* restrict whence,
- const char* restrict str, size_t maxlen)
-{
- const char* stop = strnstr(whence, str, maxlen);
- size_t n = stop == NULL ? strnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
- memcpy(whither, whence, n);
- memset(whither, 0, maxlen - n);
- return r;
-}
-
diff --git a/src/string/str/strstrnmove.c b/src/string/str/strstrnmove.c
deleted file mode 100644
index 9bec614..0000000
--- a/src/string/str/strstrnmove.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * slibc — Yet another C library
- * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include <string.h>
-
-
-
-/**
- * Copy a memory segment to another, possibly overlapping, segment,
- * stop when a NUL byte or a specified substring is encountered.
- *
- * This is a slibc extension added for completeness.
- * It is only available if GNU extensions are available.
- *
- * @param whither The destination memory segment.
- * @param whence The source memory segment.
- * @param str The substring, ignored if `NULL`.
- * NOTE that if the resulting string at least this
- * long, no NUL byte will be written to `whither'.
- * On the otherhand, if the resultnig string is
- * shorter, `whither` will be filled with NUL bytes
- * until this amount of bytes have been written.
- * @param maxlen The maximum number of bytes to copy.
- * @return `NULL` if `str` was not encountered, otherwise
- * the position of `str` translated to `whither`,
- * that is, the address of `whither` plus the
- * number of copied characters; the address of
- * one character passed the last written non-NUL
- * character.
- */
-char* strstrnmove(char* whither, const char* whence, const char* restrict str, size_t maxlen)
-{
- const char* stop = strnstr(whence, str, maxlen);
- size_t n = stop == NULL ? strnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
- memmove(whither, whence, n);
- memset(whither, 0, maxlen - n);
- return r;
-}
-