Make all bucket and overflow addresses unsigned
[unix-history] / usr / src / lib / libc / string / strcpy.3
CommitLineData
657bdb9b
KB
1.\" Copyright (c) 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek.
6.\"
7.\" %sccs.include.redist.man%
8.\"
ee7c1421 9.\" @(#)strcpy.3 5.2 (Berkeley) %G%
657bdb9b
KB
10.\"
11.TH STRCPY 3 ""
12.UC 4
13.SH NAME
14strcpy \- copy strings
15.SH SYNOPSIS
16.nf
17.ft B
18#include <string.h>
19
20char *
21strcpy(char *dst, const char *src);
ee7c1421
KB
22
23char *
24strncpy(char *dst, const char *src, size_t len);
657bdb9b
KB
25.ft R
26.fi
27.SH DESCRIPTION
28.B Strcpy
ee7c1421
KB
29and
30.B strncpy
31copy string
657bdb9b
KB
32.I src
33to
34.IR dst ,
35stopping after the terminating '\e0' has been moved.
ee7c1421
KB
36.PP
37.B Strncpy
38writes exactly
39.I len
40characters into
41.IR dst ,
42appending '\e0' characters if
43.I src
44is less than
45.I len
46characters long, and
47.I not
48terminating
49.I dst
50if
51.I src
52is more than
53.I len
54characters long.
55.PP
657bdb9b 56.B Strcpy
ee7c1421
KB
57and
58.B strncpy
59return
657bdb9b 60.IR dst .
ee7c1421
KB
61.SH EXAMPLES
62The following sets ``chararray'' to ``abc\e0\e0\e0'':
63.sp
64.ti +0.5i
65(void)strncpy(chararray, "abc", 6).
66.PP
67The following sets ``chararray'' to ``abcdef'':
68.sp
69.RS
70(void)strncpy(chararray, "abcdefgh", 6);
71.RE
657bdb9b 72.SH SEE ALSO
ee7c1421 73bcopy(3), memccpy(3), memcpy(3), memmove(3)
657bdb9b
KB
74.SH STANDARDS
75.B Strcpy
ee7c1421
KB
76and
77.B strncpy
78conform to ANSI X3.159-1989 (``ANSI C'').