Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/string bring in EXAMPLES and ERRORS from openbsd.
details: https://anonhg.NetBSD.org/src/rev/add335d0bb27
branches: trunk
changeset: 535146:add335d0bb27
user: yamt <yamt%NetBSD.org@localhost>
date: Sun Aug 11 07:53:06 2002 +0000
description:
bring in EXAMPLES and ERRORS from openbsd.
diffstat:
lib/libc/string/strdup.3 | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diffs (42 lines):
diff -r 10c27f899861 -r add335d0bb27 lib/libc/string/strdup.3
--- a/lib/libc/string/strdup.3 Sun Aug 11 07:50:04 2002 +0000
+++ b/lib/libc/string/strdup.3 Sun Aug 11 07:53:06 2002 +0000
@@ -30,9 +30,9 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)strdup.3 8.1 (Berkeley) 6/9/93
-.\" $NetBSD: strdup.3,v 1.9 2002/02/07 07:00:32 ross Exp $
+.\" $NetBSD: strdup.3,v 1.10 2002/08/11 07:53:06 yamt Exp $
.\"
-.Dd June 9, 1993
+.Dd August 11, 2002
.Dt STRDUP 3
.Os
.Sh NAME
@@ -57,6 +57,26 @@
.Xr free 3 .
.Pp
If insufficient memory is available, NULL is returned.
+.Sh EXAMPLES
+The following will point
+.Va p
+to an allocated area of memory containing the null-terminated string
+.Qq foobar :
+.Bd -literal -offset indent
+char *p;
+
+if ((p = strdup("foobar")) == NULL) {
+ fprintf(stderr, "Out of memory.\en");
+ exit(1);
+}
+.Ed
+.Sh ERRORS
+The
+.Fn strdup
+function may fail and set the external variable
+.Va errno
+for any of the errors specified for the library function
+.Xr malloc 3 .
.Sh SEE ALSO
.Xr free 3 ,
.Xr malloc 3 ,
Home |
Main Index |
Thread Index |
Old Index