]> git.saurik.com Git - apple/libc.git/blob - string/FreeBSD/strcpy.3.patch
420ccc016ce12db45716eae0d0d891e07c75626a
[apple/libc.git] / string / FreeBSD / strcpy.3.patch
1 --- strcpy.3.orig 2008-02-29 10:45:51.000000000 -0800
2 +++ strcpy.3 2008-02-29 12:08:34.000000000 -0800
3 @@ -40,18 +40,30 @@
4 .Dt STRCPY 3
5 .Os
6 .Sh NAME
7 -.Nm strcpy , strncpy
8 +.Nm stpcpy ,
9 +.Nm strcpy ,
10 +.Nm strncpy
11 .Nd copy strings
12 .Sh LIBRARY
13 .Lb libc
14 .Sh SYNOPSIS
15 .In string.h
16 .Ft char *
17 -.Fn stpcpy "char *dst" "const char *src"
18 +.Fo stpcpy
19 +.Fa "char *s1"
20 +.Fa "const char *s2"
21 +.Fc
22 .Ft char *
23 -.Fn strcpy "char * restrict dst" "const char * restrict src"
24 +.Fo strcpy
25 +.Fa "char *restrict s1"
26 +.Fa "const char *restrict s2"
27 +.Fc
28 .Ft char *
29 -.Fn strncpy "char * restrict dst" "const char * restrict src" "size_t len"
30 +.Fo strncpy
31 +.Fa "char *restrict s1"
32 +.Fa "const char *restrict s2"
33 +.Fa "size_t n"
34 +.Fc
35 .Sh DESCRIPTION
36 The
37 .Fn stpcpy
38 @@ -59,36 +71,39 @@
39 .Fn strcpy
40 functions
41 copy the string
42 -.Fa src
43 +.Fa s2
44 to
45 -.Fa dst
46 +.Fa s1
47 (including the terminating
48 .Ql \e0
49 -character.)
50 +character).
51 .Pp
52 The
53 .Fn strncpy
54 function copies at most
55 -.Fa len
56 +.Fa n
57 characters from
58 -.Fa src
59 +.Fa s2
60 into
61 -.Fa dst .
62 +.Fa s1 .
63 If
64 -.Fa src
65 +.Fa s2
66 is less than
67 -.Fa len
68 +.Fa n
69 characters long,
70 the remainder of
71 -.Fa dst
72 +.Fa s1
73 is filled with
74 .Ql \e0
75 characters.
76 Otherwise,
77 -.Fa dst
78 +.Fa s1
79 is
80 .Em not
81 terminated.
82 +.Pp
83 +The source and destination strings should not overlap, as the
84 +behavior is undefined.
85 .Sh RETURN VALUES
86 The
87 .Fn strcpy
88 @@ -96,13 +111,13 @@
89 .Fn strncpy
90 functions
91 return
92 -.Fa dst .
93 +.Fa s1 .
94 The
95 .Fn stpcpy
96 function returns a pointer to the terminating
97 .Ql \e0
98 character of
99 -.Fa dst .
100 +.Fa s1 .
101 .Sh EXAMPLES
102 The following sets
103 .Va chararray
104 @@ -128,7 +143,7 @@
105 .Em not
106 .Tn NUL
107 terminate
108 -.Va chararray
109 +.Va chararray ,
110 because the length of the source string is greater than or equal
111 to the length argument.
112 .Pp
113 @@ -159,7 +174,7 @@
114 .Pp
115 .Dl "(void)strlcpy(buf, input, sizeof(buf));"
116 .Pp
117 -Note that because
118 +Note that, because
119 .Xr strlcpy 3
120 is not defined in any standards, it should
121 only be used when portability is not a concern.
122 @@ -179,11 +194,6 @@
123 .Xr memcpy 3 ,
124 .Xr memmove 3 ,
125 .Xr strlcpy 3
126 -.Rs
127 -.%T "The FreeBSD Security Architecture"
128 -.Re
129 -(See
130 -.Pa "/usr/share/doc/{to be decided}" . )
131 .Sh STANDARDS
132 The
133 .Fn strcpy