summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/strdup.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/string/strdup.3')
-rw-r--r--src/lib/libc/string/strdup.319
1 files changed, 10 insertions, 9 deletions
diff --git a/src/lib/libc/string/strdup.3 b/src/lib/libc/string/strdup.3
index 42a578b913..02d5666a9c 100644
--- a/src/lib/libc/string/strdup.3
+++ b/src/lib/libc/string/strdup.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: strdup.3,v 1.17 2010/05/19 06:32:43 jmc Exp $ 1.\" $OpenBSD: strdup.3,v 1.18 2011/07/25 00:38:53 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 1990, 1991, 1993 3.\" Copyright (c) 1990, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
29.\" 29.\"
30.\" @(#)strdup.3 8.1 (Berkeley) 6/9/93 30.\" @(#)strdup.3 8.1 (Berkeley) 6/9/93
31.\" 31.\"
32.Dd $Mdocdate: May 19 2010 $ 32.Dd $Mdocdate: July 25 2011 $
33.Dt STRDUP 3 33.Dt STRDUP 3
34.Os 34.Os
35.Sh NAME 35.Sh NAME
@@ -73,10 +73,8 @@ to an allocated area of memory containing the NUL-terminated string
73char *p; 73char *p;
74 74
75p = strdup("foobar"); 75p = strdup("foobar");
76if (p == NULL) { 76if (p == NULL)
77 fprintf(stderr, "Out of memory.\en"); 77 err(1, NULL);
78 exit(1);
79}
80.Ed 78.Ed
81.Sh ERRORS 79.Sh ERRORS
82The 80The
@@ -90,7 +88,8 @@ for any of the errors specified for the library function
90.Xr malloc 3 , 88.Xr malloc 3 ,
91.Xr strcpy 3 , 89.Xr strcpy 3 ,
92.Xr strlcpy 3 , 90.Xr strlcpy 3 ,
93.Xr strlen 3 91.Xr strlen 3 ,
92.Xr wcsdup 3
94.Sh STANDARDS 93.Sh STANDARDS
95The 94The
96.Fn strdup 95.Fn strdup
@@ -102,8 +101,10 @@ functions conform to
102The 101The
103.Fn strdup 102.Fn strdup
104function first appeared in 103function first appeared in
105.Bx 4.4 . 104.Bx 4.3 Reno .
106The 105The
107.Fn strndup 106.Fn strndup
108function first appeared in 107function appeared in glibc 2.0, was reimplemented for
108.Nx 4.0 ,
109and ported to
109.Ox 4.8 . 110.Ox 4.8 .