summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strdup.3
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-07-25 00:38:52 +0000
committerschwarze <schwarze@openbsd.org>2011-07-25 00:38:52 +0000
commit8c40de08f9d12a182e23e357bcca21c5be683dd9 (patch)
treedf554e154d9ded444e70f01eb8a84b1212071f78 /lib/libc/string/strdup.3
parentoccured -> occurred; (diff)
downloadwireguard-openbsd-8c40de08f9d12a182e23e357bcca21c5be683dd9.tar.xz
wireguard-openbsd-8c40de08f9d12a182e23e357bcca21c5be683dd9.zip
update HISTORY and SEE ALSO for all of string(3), together with various
smaller improvements; jmc@ and nicm@ both ask me to get this in because further tweaking will be easier in-tree
Diffstat (limited to 'lib/libc/string/strdup.3')
-rw-r--r--lib/libc/string/strdup.319
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/libc/string/strdup.3 b/lib/libc/string/strdup.3
index 42a578b913c..02d5666a9c2 100644
--- a/lib/libc/string/strdup.3
+++ b/lib/libc/string/strdup.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: strdup.3,v 1.17 2010/05/19 06:32:43 jmc Exp $
+.\" $OpenBSD: strdup.3,v 1.18 2011/07/25 00:38:53 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)strdup.3 8.1 (Berkeley) 6/9/93
.\"
-.Dd $Mdocdate: May 19 2010 $
+.Dd $Mdocdate: July 25 2011 $
.Dt STRDUP 3
.Os
.Sh NAME
@@ -73,10 +73,8 @@ to an allocated area of memory containing the NUL-terminated string
char *p;
p = strdup("foobar");
-if (p == NULL) {
- fprintf(stderr, "Out of memory.\en");
- exit(1);
-}
+if (p == NULL)
+ err(1, NULL);
.Ed
.Sh ERRORS
The
@@ -90,7 +88,8 @@ for any of the errors specified for the library function
.Xr malloc 3 ,
.Xr strcpy 3 ,
.Xr strlcpy 3 ,
-.Xr strlen 3
+.Xr strlen 3 ,
+.Xr wcsdup 3
.Sh STANDARDS
The
.Fn strdup
@@ -102,8 +101,10 @@ functions conform to
The
.Fn strdup
function first appeared in
-.Bx 4.4 .
+.Bx 4.3 Reno .
The
.Fn strndup
-function first appeared in
+function appeared in glibc 2.0, was reimplemented for
+.Nx 4.0 ,
+and ported to
.Ox 4.8 .