Browse Source

- macro, punctuation, and rewording tweaks

- avoid first person.
ok jmc
OPENBSD_3_8
jaredy 19 years ago
parent
commit
1f6f803468
4 changed files with 21 additions and 18 deletions
  1. +7
    -5
      src/lib/libc/string/strcat.3
  2. +4
    -3
      src/lib/libc/string/strcpy.3
  3. +6
    -6
      src/lib/libc/string/strlcpy.3
  4. +4
    -4
      src/lib/libc/string/wcstok.3

+ 7
- 5
src/lib/libc/string/strcat.3 View File

@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $OpenBSD: strcat.3,v 1.10 2005/02/25 03:12:44 cloder Exp $
.\" $OpenBSD: strcat.3,v 1.11 2005/08/06 03:21:36 jaredy Exp $
.\"
.Dd July 8, 1997
.Dt STRCAT 3
@ -78,7 +78,7 @@ functions return the pointer
The following appends
.Dq Li abc
to
.Dq Li chararray :
.Va chararray :
.Bd -literal -offset indent
char *letters = "abcdefghi";
@ -99,11 +99,13 @@ buf[sizeof(buf) - 1] = '\e0';
.Ed
.Pp
The above will copy as many characters from
.Dq Li input
.Va input
to
.Dq Li buf
.Va buf
as will fit.
It then appends as many characters from suffix as will fit (or none
It then appends as many characters from
.Va suffix
as will fit (or none
if there is no space).
For operations like this, the
.Xr strlcpy 3


+ 4
- 3
src/lib/libc/string/strcpy.3 View File

@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $OpenBSD: strcpy.3,v 1.13 2005/02/25 03:12:44 cloder Exp $
.\" $OpenBSD: strcpy.3,v 1.14 2005/08/06 03:21:36 jaredy Exp $
.\"
.Dd June 29, 1991
.Dt STRCPY 3
@ -100,7 +100,8 @@ and does
.Em not
NUL terminate
.Va chararray
because the source string is >= the length parameter.
because the length of the source string is greater than or equal to the
length parameter.
.Fn strncpy
.Em only
NUL terminates the destination string when the length of the source
@ -118,7 +119,7 @@ Because
.Fn strncpy
does
.Em not
guarantee to NUL terminate the string itself, we must do this by hand.
guarantee to NUL terminate the string itself, it must be done by hand.
.Bd -literal -offset indent
char buf[BUFSIZ];


+ 6
- 6
src/lib/libc/string/strlcpy.3 View File

@ -1,4 +1,4 @@
.\" $OpenBSD: strlcpy.3,v 1.16 2003/06/17 21:56:24 millert Exp $
.\" $OpenBSD: strlcpy.3,v 1.17 2005/08/06 03:21:36 jaredy Exp $
.\"
.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
@ -49,7 +49,7 @@ is larger than 0 or, in the case of
.Fn strlcat ,
as long as there is at least one byte free in
.Fa dst ) .
Note that you should include a byte for the NUL in
Note that a byte for the NUL should be included in
.Fa size .
Also note that
.Fn strlcpy
@ -105,10 +105,10 @@ that means the initial length of
plus
the length of
.Fa src .
While this may seem somewhat confusing it was done to make
While this may seem somewhat confusing, it was done to make
truncation detection simple.
.Pp
Note however, that if
Note, however, that if
.Fn strlcat
traverses
.Fa size
@ -152,8 +152,8 @@ if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname))
goto toolong;
.Ed
.Pp
Since we know how many characters we copied the first time, we can
speed things up a bit by using a copy instead of an append:
Since it is known how many characters were copied the first time, things
can be sped up a bit by using a copy instead of an append:
.Bd -literal -offset indent
char *dir, *file, pname[MAXPATHLEN];
size_t n;


+ 4
- 4
src/lib/libc/string/wcstok.3 View File

@ -1,4 +1,4 @@
.\" $OpenBSD: wcstok.3,v 1.2 2005/04/13 20:42:48 jmc Exp $
.\" $OpenBSD: wcstok.3,v 1.3 2005/08/06 03:21:36 jaredy Exp $
.\"
.\" $NetBSD: wcstok.3,v 1.3 2003/09/08 17:54:33 wiz Exp $
.\"
@ -68,7 +68,7 @@
The
.Fn wcstok
function
is used to isolate sequential tokens in a null-terminated wide character
is used to isolate sequential tokens in a NUL-terminated wide character
string,
.Fa str .
These tokens are separated in the string by at least one of the
@ -97,12 +97,12 @@ The
.Fn wcstok
function
returns a pointer to the beginning of each subsequent token in the string,
after replacing the token itself with a null wide character (L'\e0').
after replacing the token itself with a NUL wide character (L'\e0').
When no more tokens remain, a null pointer is returned.
.Sh EXAMPLES
The following code fragment splits a wide character string on
.Tn ASCII
space, tab and newline characters and writes the tokens to
space, tab, and newline characters and writes the tokens to
standard output:
.Bd -literal -offset indent
const wchar_t *seps = L" \et\en";


Loading…
Cancel
Save