summaryrefslogtreecommitdiff
path: root/src/lib/libc
diff options
context:
space:
mode:
authorkettenis <>2010-03-24 14:47:46 +0000
committerkettenis <>2010-03-24 14:47:46 +0000
commit1f2b173c731887c107ce6149ec692bc146805ffd (patch)
treebc1bda44d06c93d6c8c4453b273f1dd2adb5e13a /src/lib/libc
parenta7a853e149f5a2468fd738638c4641dd59d6bc31 (diff)
downloadopenbsd-1f2b173c731887c107ce6149ec692bc146805ffd.tar.gz
openbsd-1f2b173c731887c107ce6149ec692bc146805ffd.tar.bz2
openbsd-1f2b173c731887c107ce6149ec692bc146805ffd.zip
Modify example not to use an assignment in the if statement. We shouldn't
teach people bad habits! ok krw@, jmc@, dlg@, thib@
Diffstat (limited to 'src/lib/libc')
-rw-r--r--src/lib/libc/string/strdup.37
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libc/string/strdup.3 b/src/lib/libc/string/strdup.3
index 5ef38e38f3..60a7462777 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.14 2007/05/31 19:19:32 jmc Exp $ 1.\" $OpenBSD: strdup.3,v 1.15 2010/03/24 14:47:46 kettenis 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 31 2007 $ 32.Dd $Mdocdate: March 24 2010 $
33.Dt STRDUP 3 33.Dt STRDUP 3
34.Os 34.Os
35.Sh NAME 35.Sh NAME
@@ -59,7 +59,8 @@ to an allocated area of memory containing the NUL-terminated string
59.Bd -literal -offset indent 59.Bd -literal -offset indent
60char *p; 60char *p;
61 61
62if ((p = strdup("foobar")) == NULL) { 62p = strdup("foobar");
63if (p == NULL) {
63 fprintf(stderr, "Out of memory.\en"); 64 fprintf(stderr, "Out of memory.\en");
64 exit(1); 65 exit(1);
65} 66}