summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjaredy <>2005-08-06 03:21:36 +0000
committerjaredy <>2005-08-06 03:21:36 +0000
commit688d6cbb33ef71f63fab8688e85ac2f7aeb7b164 (patch)
tree77512edbdfbc7521fca9b386450af369c7b4ee75 /src
parent932da6a5c29178852f64fcd9163a9ea6b06cd011 (diff)
downloadopenbsd-688d6cbb33ef71f63fab8688e85ac2f7aeb7b164.tar.gz
openbsd-688d6cbb33ef71f63fab8688e85ac2f7aeb7b164.tar.bz2
openbsd-688d6cbb33ef71f63fab8688e85ac2f7aeb7b164.zip
- macro, punctuation, and rewording tweaks
- avoid first person. ok jmc
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/string/strcat.312
-rw-r--r--src/lib/libc/string/strcpy.37
-rw-r--r--src/lib/libc/string/strlcpy.312
-rw-r--r--src/lib/libc/string/wcstok.38
4 files changed, 21 insertions, 18 deletions
diff --git a/src/lib/libc/string/strcat.3 b/src/lib/libc/string/strcat.3
index 89d368c3fb..b81e724917 100644
--- a/src/lib/libc/string/strcat.3
+++ b/src/lib/libc/string/strcat.3
@@ -29,7 +29,7 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: strcat.3,v 1.10 2005/02/25 03:12:44 cloder Exp $ 32.\" $OpenBSD: strcat.3,v 1.11 2005/08/06 03:21:36 jaredy Exp $
33.\" 33.\"
34.Dd July 8, 1997 34.Dd July 8, 1997
35.Dt STRCAT 3 35.Dt STRCAT 3
@@ -78,7 +78,7 @@ functions return the pointer
78The following appends 78The following appends
79.Dq Li abc 79.Dq Li abc
80to 80to
81.Dq Li chararray : 81.Va chararray :
82.Bd -literal -offset indent 82.Bd -literal -offset indent
83char *letters = "abcdefghi"; 83char *letters = "abcdefghi";
84 84
@@ -99,11 +99,13 @@ buf[sizeof(buf) - 1] = '\e0';
99.Ed 99.Ed
100.Pp 100.Pp
101The above will copy as many characters from 101The above will copy as many characters from
102.Dq Li input 102.Va input
103to 103to
104.Dq Li buf 104.Va buf
105as will fit. 105as will fit.
106It then appends as many characters from suffix as will fit (or none 106It then appends as many characters from
107.Va suffix
108as will fit (or none
107if there is no space). 109if there is no space).
108For operations like this, the 110For operations like this, the
109.Xr strlcpy 3 111.Xr strlcpy 3
diff --git a/src/lib/libc/string/strcpy.3 b/src/lib/libc/string/strcpy.3
index 504f42f2ba..2bc413c6ca 100644
--- a/src/lib/libc/string/strcpy.3
+++ b/src/lib/libc/string/strcpy.3
@@ -29,7 +29,7 @@
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE. 30.\" SUCH DAMAGE.
31.\" 31.\"
32.\" $OpenBSD: strcpy.3,v 1.13 2005/02/25 03:12:44 cloder Exp $ 32.\" $OpenBSD: strcpy.3,v 1.14 2005/08/06 03:21:36 jaredy Exp $
33.\" 33.\"
34.Dd June 29, 1991 34.Dd June 29, 1991
35.Dt STRCPY 3 35.Dt STRCPY 3
@@ -100,7 +100,8 @@ and does
100.Em not 100.Em not
101NUL terminate 101NUL terminate
102.Va chararray 102.Va chararray
103because the source string is >= the length parameter. 103because the length of the source string is greater than or equal to the
104length parameter.
104.Fn strncpy 105.Fn strncpy
105.Em only 106.Em only
106NUL terminates the destination string when the length of the source 107NUL terminates the destination string when the length of the source
@@ -118,7 +119,7 @@ Because
118.Fn strncpy 119.Fn strncpy
119does 120does
120.Em not 121.Em not
121guarantee to NUL terminate the string itself, we must do this by hand. 122guarantee to NUL terminate the string itself, it must be done by hand.
122.Bd -literal -offset indent 123.Bd -literal -offset indent
123char buf[BUFSIZ]; 124char buf[BUFSIZ];
124 125
diff --git a/src/lib/libc/string/strlcpy.3 b/src/lib/libc/string/strlcpy.3
index b392588879..c728c75e51 100644
--- a/src/lib/libc/string/strlcpy.3
+++ b/src/lib/libc/string/strlcpy.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: strlcpy.3,v 1.16 2003/06/17 21:56:24 millert Exp $ 1.\" $OpenBSD: strlcpy.3,v 1.17 2005/08/06 03:21:36 jaredy Exp $
2.\" 2.\"
3.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com> 3.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com>
4.\" 4.\"
@@ -49,7 +49,7 @@ is larger than 0 or, in the case of
49.Fn strlcat , 49.Fn strlcat ,
50as long as there is at least one byte free in 50as long as there is at least one byte free in
51.Fa dst ) . 51.Fa dst ) .
52Note that you should include a byte for the NUL in 52Note that a byte for the NUL should be included in
53.Fa size . 53.Fa size .
54Also note that 54Also note that
55.Fn strlcpy 55.Fn strlcpy
@@ -105,10 +105,10 @@ that means the initial length of
105plus 105plus
106the length of 106the length of
107.Fa src . 107.Fa src .
108While this may seem somewhat confusing it was done to make 108While this may seem somewhat confusing, it was done to make
109truncation detection simple. 109truncation detection simple.
110.Pp 110.Pp
111Note however, that if 111Note, however, that if
112.Fn strlcat 112.Fn strlcat
113traverses 113traverses
114.Fa size 114.Fa size
@@ -152,8 +152,8 @@ if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname))
152 goto toolong; 152 goto toolong;
153.Ed 153.Ed
154.Pp 154.Pp
155Since we know how many characters we copied the first time, we can 155Since it is known how many characters were copied the first time, things
156speed things up a bit by using a copy instead of an append: 156can be sped up a bit by using a copy instead of an append:
157.Bd -literal -offset indent 157.Bd -literal -offset indent
158char *dir, *file, pname[MAXPATHLEN]; 158char *dir, *file, pname[MAXPATHLEN];
159size_t n; 159size_t n;
diff --git a/src/lib/libc/string/wcstok.3 b/src/lib/libc/string/wcstok.3
index dd3f36cfd5..28291888f5 100644
--- a/src/lib/libc/string/wcstok.3
+++ b/src/lib/libc/string/wcstok.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: wcstok.3,v 1.2 2005/04/13 20:42:48 jmc Exp $ 1.\" $OpenBSD: wcstok.3,v 1.3 2005/08/06 03:21:36 jaredy Exp $
2.\" 2.\"
3.\" $NetBSD: wcstok.3,v 1.3 2003/09/08 17:54:33 wiz Exp $ 3.\" $NetBSD: wcstok.3,v 1.3 2003/09/08 17:54:33 wiz Exp $
4.\" 4.\"
@@ -68,7 +68,7 @@
68The 68The
69.Fn wcstok 69.Fn wcstok
70function 70function
71is used to isolate sequential tokens in a null-terminated wide character 71is used to isolate sequential tokens in a NUL-terminated wide character
72string, 72string,
73.Fa str . 73.Fa str .
74These tokens are separated in the string by at least one of the 74These tokens are separated in the string by at least one of the
@@ -97,12 +97,12 @@ The
97.Fn wcstok 97.Fn wcstok
98function 98function
99returns a pointer to the beginning of each subsequent token in the string, 99returns a pointer to the beginning of each subsequent token in the string,
100after replacing the token itself with a null wide character (L'\e0'). 100after replacing the token itself with a NUL wide character (L'\e0').
101When no more tokens remain, a null pointer is returned. 101When no more tokens remain, a null pointer is returned.
102.Sh EXAMPLES 102.Sh EXAMPLES
103The following code fragment splits a wide character string on 103The following code fragment splits a wide character string on
104.Tn ASCII 104.Tn ASCII
105space, tab and newline characters and writes the tokens to 105space, tab, and newline characters and writes the tokens to
106standard output: 106standard output:
107.Bd -literal -offset indent 107.Bd -literal -offset indent
108const wchar_t *seps = L" \et\en"; 108const wchar_t *seps = L" \et\en";