strcpy.3.patch   [plain text]


--- strcpy.3.orig	2008-02-29 10:45:51.000000000 -0800
+++ strcpy.3	2008-02-29 12:08:34.000000000 -0800
@@ -40,18 +40,30 @@
 .Dt STRCPY 3
 .Os
 .Sh NAME
-.Nm strcpy , strncpy
+.Nm stpcpy ,
+.Nm strcpy ,
+.Nm strncpy
 .Nd copy strings
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In string.h
 .Ft char *
-.Fn stpcpy "char *dst" "const char *src"
+.Fo stpcpy
+.Fa "char *s1"
+.Fa "const char *s2"
+.Fc
 .Ft char *
-.Fn strcpy "char * restrict dst" "const char * restrict src"
+.Fo strcpy
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fc
 .Ft char *
-.Fn strncpy "char * restrict dst" "const char * restrict src" "size_t len"
+.Fo strncpy
+.Fa "char *restrict s1"
+.Fa "const char *restrict s2"
+.Fa "size_t n"
+.Fc
 .Sh DESCRIPTION
 The
 .Fn stpcpy
@@ -59,36 +71,39 @@
 .Fn strcpy
 functions
 copy the string
-.Fa src
+.Fa s2
 to
-.Fa dst
+.Fa s1
 (including the terminating
 .Ql \e0
-character.)
+character).
 .Pp
 The
 .Fn strncpy
 function copies at most
-.Fa len
+.Fa n
 characters from
-.Fa src
+.Fa s2
 into
-.Fa dst .
+.Fa s1 .
 If
-.Fa src
+.Fa s2
 is less than
-.Fa len
+.Fa n
 characters long,
 the remainder of
-.Fa dst
+.Fa s1
 is filled with
 .Ql \e0
 characters.
 Otherwise,
-.Fa dst
+.Fa s1
 is
 .Em not
 terminated.
+.Pp
+The source and destination strings should not overlap, as the
+behavior is undefined.
 .Sh RETURN VALUES
 The
 .Fn strcpy
@@ -96,13 +111,13 @@
 .Fn strncpy
 functions
 return
-.Fa dst .
+.Fa s1 .
 The
 .Fn stpcpy
 function returns a pointer to the terminating
 .Ql \e0
 character of
-.Fa dst .
+.Fa s1 .
 .Sh EXAMPLES
 The following sets
 .Va chararray
@@ -128,7 +143,7 @@
 .Em not
 .Tn NUL
 terminate
-.Va chararray
+.Va chararray ,
 because the length of the source string is greater than or equal
 to the length argument.
 .Pp
@@ -159,7 +174,7 @@
 .Pp
 .Dl "(void)strlcpy(buf, input, sizeof(buf));"
 .Pp
-Note that because
+Note that, because
 .Xr strlcpy 3
 is not defined in any standards, it should
 only be used when portability is not a concern.
@@ -179,11 +194,6 @@
 .Xr memcpy 3 ,
 .Xr memmove 3 ,
 .Xr strlcpy 3
-.Rs
-.%T "The FreeBSD Security Architecture"
-.Re
-(See
-.Pa "/usr/share/doc/{to be decided}" . )
 .Sh STANDARDS
 The
 .Fn strcpy