|
@ -1,4 +1,4 @@ |
|
|
.\" $OpenBSD: strdup.3,v 1.14 2007/05/31 19:19:32 jmc Exp $ |
|
|
|
|
|
|
|
|
.\" $OpenBSD: strdup.3,v 1.15 2010/03/24 14:47:46 kettenis Exp $ |
|
|
.\" |
|
|
.\" |
|
|
.\" Copyright (c) 1990, 1991, 1993 |
|
|
.\" Copyright (c) 1990, 1991, 1993 |
|
|
.\" The Regents of the University of California. All rights reserved. |
|
|
.\" The Regents of the University of California. All rights reserved. |
|
@ -29,7 +29,7 @@ |
|
|
.\" |
|
|
.\" |
|
|
.\" @(#)strdup.3 8.1 (Berkeley) 6/9/93 |
|
|
.\" @(#)strdup.3 8.1 (Berkeley) 6/9/93 |
|
|
.\" |
|
|
.\" |
|
|
.Dd $Mdocdate: May 31 2007 $ |
|
|
|
|
|
|
|
|
.Dd $Mdocdate: March 24 2010 $ |
|
|
.Dt STRDUP 3 |
|
|
.Dt STRDUP 3 |
|
|
.Os |
|
|
.Os |
|
|
.Sh NAME |
|
|
.Sh NAME |
|
@ -59,7 +59,8 @@ to an allocated area of memory containing the NUL-terminated string |
|
|
.Bd -literal -offset indent |
|
|
.Bd -literal -offset indent |
|
|
char *p; |
|
|
char *p; |
|
|
|
|
|
|
|
|
if ((p = strdup("foobar")) == NULL) { |
|
|
|
|
|
|
|
|
p = strdup("foobar"); |
|
|
|
|
|
if (p == NULL) { |
|
|
fprintf(stderr, "Out of memory.\en"); |
|
|
fprintf(stderr, "Out of memory.\en"); |
|
|
exit(1); |
|
|
exit(1); |
|
|
} |
|
|
} |
|
|