Page MenuHomeFreeBSD

D27623.id80725.diff
No OneTemporary

D27623.id80725.diff

Index: lib/libc/string/strerror.3
===================================================================
--- lib/libc/string/strerror.3
+++ lib/libc/string/strerror.3
@@ -32,7 +32,7 @@
.\" @(#)strerror.3 8.1 (Berkeley) 6/9/93
.\" $FreeBSD$
.\"
-.Dd April 5, 2011
+.Dd December 15, 2020
.Dt STRERROR 3
.Os
.Sh NAME
@@ -145,6 +145,29 @@
or
.Fn strerror_r
should be used instead.
+.Sh EXAMPLES
+The following example shows how to use
+.Fn perror
+to report an error.
+.Bd -literal -offset 2n
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int
+main()
+{
+
+ if (pipe(NULL) < 0) {
+ perror("pipe()");
+ exit(1);
+ }
+ return (0);
+}
+.Ed
+.Pp
+When executed, the program will print an error message along the lines of
+.Ql pipe(): Bad address .
.Sh SEE ALSO
.Xr intro 2 ,
.Xr err 3 ,

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 11, 8:36 PM (4 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31306938
Default Alt Text
D27623.id80725.diff (813 B)

Event Timeline