diff options
| author | Alejandro Colomar <alx@kernel.org> | 2026-02-25 23:15:14 +0100 |
|---|---|---|
| committer | Alejandro Colomar <alx@kernel.org> | 2026-02-25 23:17:20 +0100 |
| commit | 36697bf866d7ea2aa9984b5f38faddc93d7050cb (patch) | |
| tree | 258fd9e57d761c773970213327f54fa267906c5a | |
| parent | 08d1c78c455af5910152369eb1e3d1796476fabb (diff) | |
| download | man-pages-36697bf866d7ea2aa9984b5f38faddc93d7050cb.tar.gz | |
man/man3/strcpy.3: Compare str{cpy,cat}(3) to stpcpy(3)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
| -rw-r--r-- | man/man3/strcpy.3 | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/man/man3/strcpy.3 b/man/man3/strcpy.3 index 3b322ddd2a..cea24ff040 100644 --- a/man/man3/strcpy.3 +++ b/man/man3/strcpy.3 @@ -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 |
