Deleted Added
full compact
strcpy.3 (165903) strcpy.3 (189136)
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)strcpy.3 8.1 (Berkeley) 6/4/93
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)strcpy.3 8.1 (Berkeley) 6/4/93
33.\" $FreeBSD: head/lib/libc/string/strcpy.3 165903 2007-01-09 00:28:16Z imp $
33.\" $FreeBSD: head/lib/libc/string/strcpy.3 189136 2009-02-28 06:00:58Z das $
34.\"
34.\"
35.Dd August 9, 2001
35.Dd February 28, 2009
36.Dt STRCPY 3
37.Os
38.Sh NAME
36.Dt STRCPY 3
37.Os
38.Sh NAME
39.Nm strcpy , strncpy
39.Nm stpcpy, stpncpy, strcpy , strncpy
40.Nd copy strings
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In string.h
45.Ft char *
40.Nd copy strings
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In string.h
45.Ft char *
46.Fn stpcpy "char *dst" "const char *src"
46.Fn stpcpy "char * restrict dst" "const char * restrict src"
47.Ft char *
47.Ft char *
48.Fn stpncpy "char * restrict dst" "const char * restrict src" "size_t len"
49.Ft char *
48.Fn strcpy "char * restrict dst" "const char * restrict src"
49.Ft char *
50.Fn strncpy "char * restrict dst" "const char * restrict src" "size_t len"
51.Sh DESCRIPTION
52The
53.Fn stpcpy
54and
55.Fn strcpy
56functions
57copy the string
58.Fa src
59to
60.Fa dst
61(including the terminating
62.Ql \e0
63character.)
64.Pp
65The
50.Fn strcpy "char * restrict dst" "const char * restrict src"
51.Ft char *
52.Fn strncpy "char * restrict dst" "const char * restrict src" "size_t len"
53.Sh DESCRIPTION
54The
55.Fn stpcpy
56and
57.Fn strcpy
58functions
59copy the string
60.Fa src
61to
62.Fa dst
63(including the terminating
64.Ql \e0
65character.)
66.Pp
67The
68.Fn stpncpy
69and
66.Fn strncpy
70.Fn strncpy
67function copies at most
71functions copy at most
68.Fa len
69characters from
70.Fa src
71into
72.Fa dst .
73If
74.Fa src
75is less than

--- 14 unchanged lines hidden (view full) ---

90.Fn strcpy
91and
92.Fn strncpy
93functions
94return
95.Fa dst .
96The
97.Fn stpcpy
72.Fa len
73characters from
74.Fa src
75into
76.Fa dst .
77If
78.Fa src
79is less than

--- 14 unchanged lines hidden (view full) ---

94.Fn strcpy
95and
96.Fn strncpy
97functions
98return
99.Fa dst .
100The
101.Fn stpcpy
98function returns a pointer to the terminating
102and
103.Fn stpncpy
104functions return a pointer to the terminating
99.Ql \e0
100character of
101.Fa dst .
105.Ql \e0
106character of
107.Fa dst .
108If
109.Fn stpncpy
110does not terminate
111.Fa dst
112with a
113.Dv NUL
114character, it instead returns a pointer to
115.Li dst[n]
116(which does not necessarily refer to a valid memory location.)
102.Sh EXAMPLES
103The following sets
104.Va chararray
105to
106.Dq Li abc\e0\e0\e0 :
107.Bd -literal -offset indent
108char chararray[6];
109

--- 70 unchanged lines hidden (view full) ---

180.Fn strcpy
181and
182.Fn strncpy
183functions
184conform to
185.St -isoC .
186The
187.Fn stpcpy
117.Sh EXAMPLES
118The following sets
119.Va chararray
120to
121.Dq Li abc\e0\e0\e0 :
122.Bd -literal -offset indent
123char chararray[6];
124

--- 70 unchanged lines hidden (view full) ---

195.Fn strcpy
196and
197.Fn strncpy
198functions
199conform to
200.St -isoC .
201The
202.Fn stpcpy
188function is an MS-DOS and GNUism.
189The
190.Fn stpcpy
191function
192conforms to no standard.
203and
204.Fn stpncpy
205functions conform to
206.St -p1003.1-2008 .
193.Sh HISTORY
194The
195.Fn stpcpy
196function first appeared in
197.Fx 4.4 ,
207.Sh HISTORY
208The
209.Fn stpcpy
210function first appeared in
211.Fx 4.4 ,
198coming from 1998-vintage Linux.
212and
213.Fn stpncpy
214was added in
215.Fx 8.0 .