diff options
author | guenther <> | 2012-01-17 02:48:01 +0000 |
---|---|---|
committer | guenther <> | 2012-01-17 02:48:01 +0000 |
commit | 4eca3ab70369d6a5f04d2cab60742d0d7f171399 (patch) | |
tree | 10185abaa3846292f512d026acaf2a4992992b28 /src/lib/libc/string/stpcpy.3 | |
parent | efaeb5589cc66ce5e81f0b91547c67428ad04ed5 (diff) | |
download | openbsd-4eca3ab70369d6a5f04d2cab60742d0d7f171399.tar.gz openbsd-4eca3ab70369d6a5f04d2cab60742d0d7f171399.tar.bz2 openbsd-4eca3ab70369d6a5f04d2cab60742d0d7f171399.zip |
Add stpcpy() and stpncpy(), pointless crap that made it into POSIX.
Includes friendly linker warning to wake up those dumb enough to use it.
Committing for kettenis@, who ran away to the hills after writing it
Diffstat (limited to 'src/lib/libc/string/stpcpy.3')
-rw-r--r-- | src/lib/libc/string/stpcpy.3 | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/src/lib/libc/string/stpcpy.3 b/src/lib/libc/string/stpcpy.3 new file mode 100644 index 0000000000..7067186e2b --- /dev/null +++ b/src/lib/libc/string/stpcpy.3 | |||
@@ -0,0 +1,117 @@ | |||
1 | .\" $OpenBSD: stpcpy.3,v 1.1 2012/01/17 02:48:01 guenther Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. | ||
4 | .\" All rights reserved. | ||
5 | .\" | ||
6 | .\" This code is derived from software contributed to Berkeley by | ||
7 | .\" Chris Torek and the American National Standards Committee X3, | ||
8 | .\" on Information Processing Systems. | ||
9 | .\" | ||
10 | .\" Redistribution and use in source and binary forms, with or without | ||
11 | .\" modification, are permitted provided that the following conditions | ||
12 | .\" are met: | ||
13 | .\" 1. Redistributions of source code must retain the above copyright | ||
14 | .\" notice, this list of conditions and the following disclaimer. | ||
15 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
16 | .\" notice, this list of conditions and the following disclaimer in the | ||
17 | .\" documentation and/or other materials provided with the distribution. | ||
18 | .\" 3. Neither the name of the University nor the names of its contributors | ||
19 | .\" may be used to endorse or promote products derived from this software | ||
20 | .\" without specific prior written permission. | ||
21 | .\" | ||
22 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
23 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
24 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
25 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
26 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
27 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
28 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
29 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
30 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
32 | .\" SUCH DAMAGE. | ||
33 | .\" | ||
34 | .Dd $Mdocdate: January 17 2012 $ | ||
35 | .Dt STPCPY 3 | ||
36 | .Os | ||
37 | .Sh NAME | ||
38 | .Nm stpcpy , | ||
39 | .Nm stpncpy | ||
40 | .Nd copy strings | ||
41 | .Sh SYNOPSIS | ||
42 | .Fd #include <string.h> | ||
43 | .Ft char * | ||
44 | .Fn stpcpy "char *dst" "const char *src" | ||
45 | .Ft char * | ||
46 | .Fn stpncpy "char *dst" "const char *src" "size_t len" | ||
47 | .Sh DESCRIPTION | ||
48 | The | ||
49 | .Fn stpcpy | ||
50 | and | ||
51 | .Fn stpncpy | ||
52 | functions copy the string | ||
53 | .Fa src | ||
54 | to | ||
55 | .Fa dst | ||
56 | (including the terminating | ||
57 | .Ql \e0 | ||
58 | character). | ||
59 | .Pp | ||
60 | The | ||
61 | .Fn stpncpy | ||
62 | function copies not more than | ||
63 | .Fa len | ||
64 | characters into | ||
65 | .Fa dst , | ||
66 | appending | ||
67 | .Ql \e0 | ||
68 | characters if | ||
69 | .Fa src | ||
70 | is less than | ||
71 | .Fa len | ||
72 | characters long, and | ||
73 | .Em not | ||
74 | terminating | ||
75 | .Fa dst | ||
76 | if the length of | ||
77 | .Fa src | ||
78 | is greater than or equal to | ||
79 | .Fa len . | ||
80 | .Sh RETURN VALUES | ||
81 | The | ||
82 | .Fn stpcpy | ||
83 | function returns a pointer to the terminating | ||
84 | .Ql \e0 | ||
85 | character written into | ||
86 | .Fa dst . | ||
87 | .Pp | ||
88 | The | ||
89 | .Fn stpncpy | ||
90 | function returns a pointer to the first | ||
91 | .Ql \e0 | ||
92 | character written into | ||
93 | .Fa dst , | ||
94 | or to | ||
95 | .Fa &dst[len] | ||
96 | if the length of | ||
97 | .Fa src | ||
98 | is greater than or equal to | ||
99 | .Fa len . | ||
100 | .Sh SEE ALSO | ||
101 | .Xr strcpy 3 , | ||
102 | .Xr strncpy 3 , | ||
103 | .Xr strlcpy 3 , | ||
104 | .Sh STANDARDS | ||
105 | The | ||
106 | .Fn stpcpy | ||
107 | and | ||
108 | .Fn stpncpy | ||
109 | functions conform to | ||
110 | .St -p1003.1-2008 . | ||
111 | .Sh HISTORY | ||
112 | The | ||
113 | .Fn stpcpy | ||
114 | and | ||
115 | .Fn stpncpy | ||
116 | functions first appeared in | ||
117 | .Ox 5.1 . | ||