diff options
author | aaron <> | 1999-06-04 19:14:56 +0000 |
---|---|---|
committer | aaron <> | 1999-06-04 19:14:56 +0000 |
commit | 569578dc356ba2402bc9d1b54016c009127366cb (patch) | |
tree | a66749999785172106ab5135b5e7840c8e7b9541 /src/lib/libc/string/strcpy.3 | |
parent | b54ee9c910d2afd114c02825c362ba253d8bf917 (diff) | |
download | openbsd-569578dc356ba2402bc9d1b54016c009127366cb.tar.gz openbsd-569578dc356ba2402bc9d1b54016c009127366cb.tar.bz2 openbsd-569578dc356ba2402bc9d1b54016c009127366cb.zip |
some repairs, add example to strdup(3) page
Diffstat (limited to 'src/lib/libc/string/strcpy.3')
-rw-r--r-- | src/lib/libc/string/strcpy.3 | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libc/string/strcpy.3 b/src/lib/libc/string/strcpy.3 index 80d528caef..75727223ff 100644 --- a/src/lib/libc/string/strcpy.3 +++ b/src/lib/libc/string/strcpy.3 | |||
@@ -33,13 +33,14 @@ | |||
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" $OpenBSD: strcpy.3,v 1.6 1999/05/23 14:11:03 aaron Exp $ | 36 | .\" $OpenBSD: strcpy.3,v 1.7 1999/06/04 19:14:56 aaron Exp $ |
37 | .\" | 37 | .\" |
38 | .Dd June 29, 1991 | 38 | .Dd June 29, 1991 |
39 | .Dt STRCPY 3 | 39 | .Dt STRCPY 3 |
40 | .Os | 40 | .Os |
41 | .Sh NAME | 41 | .Sh NAME |
42 | .Nm strcpy | 42 | .Nm strcpy, |
43 | .Nm strncpy | ||
43 | .Nd copy strings | 44 | .Nd copy strings |
44 | .Sh SYNOPSIS | 45 | .Sh SYNOPSIS |
45 | .Fd #include <string.h> | 46 | .Fd #include <string.h> |
@@ -61,7 +62,6 @@ to | |||
61 | .Ql \e0 | 62 | .Ql \e0 |
62 | character). | 63 | character). |
63 | .Pp | 64 | .Pp |
64 | The | ||
65 | .Fn strncpy | 65 | .Fn strncpy |
66 | copies not more than | 66 | copies not more than |
67 | .Fa len | 67 | .Fa len |
@@ -105,10 +105,10 @@ to | |||
105 | .Dq Li abcdef | 105 | .Dq Li abcdef |
106 | and does | 106 | and does |
107 | .Em not | 107 | .Em not |
108 | NUL-terminate chararray because the source string is >= the length parameter. | 108 | null terminate chararray because the source string is >= the length parameter. |
109 | .Fn strncpy | 109 | .Fn strncpy |
110 | .Em only | 110 | .Em only |
111 | NUL-terminates the destination string when then length of the source | 111 | null terminates the destination string when then length of the source |
112 | string is less than the length parameter. | 112 | string is less than the length parameter. |
113 | .Bd -literal -offset indent | 113 | .Bd -literal -offset indent |
114 | (void)strncpy(chararray, "abcdefgh", 6); | 114 | (void)strncpy(chararray, "abcdefgh", 6); |
@@ -118,11 +118,11 @@ The following copies as many characters from | |||
118 | .Dq Li input | 118 | .Dq Li input |
119 | to | 119 | to |
120 | .Dq Li buf | 120 | .Dq Li buf |
121 | as will fit and NUL-terminates the result. Because | 121 | as will fit and null terminates the result. Because |
122 | .Fn strncpy | 122 | .Fn strncpy |
123 | does | 123 | does |
124 | .Em not | 124 | .Em not |
125 | guarantee to NUL-terminate the string itself, we must do this by hand. | 125 | guarantee to null terminate the string itself, we must do this by hand. |
126 | .Bd -literal -offset indent | 126 | .Bd -literal -offset indent |
127 | char buf[BUFSIZ]; | 127 | char buf[BUFSIZ]; |
128 | 128 | ||