]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
man/man3/strcpy.3: Compare str{cpy,cat}(3) to stpcpy(3)
authorAlejandro Colomar <alx@kernel.org>
Wed, 25 Feb 2026 22:15:14 +0000 (23:15 +0100)
committerAlejandro Colomar <alx@kernel.org>
Wed, 25 Feb 2026 22:17:20 +0000 (23:17 +0100)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
man/man3/strcpy.3

index 3b322ddd2a1b0d75927c9c74bb4447eefb1ccc00..cea24ff040206c939e8b2e1cb7477c52b99938e6 100644 (file)
@@ -27,6 +27,14 @@ at the buffer pointed to by
 The programmer is responsible for allocating a destination buffer large enough,
 that is,
 .IR "strlen(src) + 1" .
+.IP
+It is equivalent to
+.IP
+.in +4n
+.EX
+stpcpy(dst, src), dst
+.EE
+.in
 .TP
 .BR strcat ()
 This function catenates the string pointed to by
@@ -37,26 +45,12 @@ after the string pointed to by
 The programmer is responsible for allocating a destination buffer large enough,
 that is,
 .IR "strlen(dst) + strlen(src) + 1" .
-.P
-An implementation of these functions might be:
-.P
+.IP
+It is equivalent to
+.IP
 .in +4n
 .EX
-#define strnul(s)  strchr(s, \[aq]\[rs]0\[aq])
-\&
-char *
-strcpy(char *restrict dst, const char *restrict src)
-{
-    stpcpy(dst, src);
-    return dst;
-}
-\&
-char *
-strcat(char *restrict dst, const char *restrict src)
-{
-    stpcpy(strnul(dst), src);
-    return dst;
-}
+stpcpy(strnul(dst), src), dst
 .EE
 .in
 .SH RETURN VALUE