xref: /freebsd/share/examples/mdoc/example.3 (revision fff9b4746224a9d404634c3ac5f8622b04d1e0ff)
1*fff9b474SMateusz Piotrowski.\"
2*fff9b474SMateusz Piotrowski.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*fff9b474SMateusz Piotrowski.\"
4374334e4SBruce Evans.\" Copyright (c) [year] [your name]
59a78dbdeSMike Pritchard.\"
69a78dbdeSMike Pritchard.\" Redistribution and use in source and binary forms, with or without
79a78dbdeSMike Pritchard.\" modification, are permitted provided that the following conditions
89a78dbdeSMike Pritchard.\" are met:
99a78dbdeSMike Pritchard.\" 1. Redistributions of source code must retain the above copyright
109a78dbdeSMike Pritchard.\"    notice, this list of conditions and the following disclaimer.
119a78dbdeSMike Pritchard.\" 2. Redistributions in binary form must reproduce the above copyright
129a78dbdeSMike Pritchard.\"    notice, this list of conditions and the following disclaimer in the
139a78dbdeSMike Pritchard.\"    documentation and/or other materials provided with the distribution.
149a78dbdeSMike Pritchard.\"
15374334e4SBruce Evans.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
169a78dbdeSMike Pritchard.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
179a78dbdeSMike Pritchard.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
189a78dbdeSMike Pritchard.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
199a78dbdeSMike Pritchard.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
209a78dbdeSMike Pritchard.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
219a78dbdeSMike Pritchard.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
229a78dbdeSMike Pritchard.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
239a78dbdeSMike Pritchard.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
249a78dbdeSMike Pritchard.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
259a78dbdeSMike Pritchard.\" SUCH DAMAGE.
269a78dbdeSMike Pritchard.\"
277dc5a4daSMike Pritchard.\" $FreeBSD$
289a78dbdeSMike Pritchard.\"
2981fba91bSMike Pritchard.\" Note: The date here should be updated whenever a non-trivial
3081fba91bSMike Pritchard.\" change is made to the manual page.
3124c875f9SRuslan Ermilov.Dd July 30, 2004
329a78dbdeSMike Pritchard.Dt EXAMPLE 3
339fdcafcfSRuslan Ermilov.Os
349a78dbdeSMike Pritchard.Sh NAME
359a78dbdeSMike Pritchard.Nm example
36d72ca9ddSRuslan Ermilov.Nd "example library function manual page"
370d2332f2SAlexey Zelkin.Sh LIBRARY
381837dd5dSRuslan Ermilov.\" Note: list of available libraries is available in mdoc(7)
390d2332f2SAlexey Zelkin.Lb libc
409a78dbdeSMike Pritchard.Sh SYNOPSIS
41d72ca9ddSRuslan Ermilov.In example.h
429a78dbdeSMike Pritchard.Ft int
439a78dbdeSMike Pritchard.Fn example "char *ptr" "int mode"
449a78dbdeSMike Pritchard.Sh DESCRIPTION
4503e563d7SSheldon HearnThis is an example library function manual page for the
469a78dbdeSMike Pritchard.Fn example
4703e563d7SSheldon Hearnfunction.
4803e563d7SSheldon HearnIt is intended that this example can be used as a template
4903e563d7SSheldon Hearnwhen writing a new manual page.
509a78dbdeSMike Pritchard.Pp
519a78dbdeSMike PritchardThe
529a78dbdeSMike Pritchard.Fn example
539a78dbdeSMike Pritchardfunction takes two arguments:
549a78dbdeSMike Pritchard.Fa ptr
559a78dbdeSMike Pritchardand
569a78dbdeSMike Pritchard.Fa mode .
579a78dbdeSMike PritchardThe argument
589a78dbdeSMike Pritchard.Fa mode
599a78dbdeSMike Pritchardmay have one of the following values:
60d72ca9ddSRuslan Ermilov.Bl -tag -width ".Dv EXAMPLE_ONE"
619a78dbdeSMike Pritchard.It Dv EXAMPLE_ONE
629a78dbdeSMike PritchardFirst example of a defined variable.
63d0353b83SRuslan Ermilov.Dv EXAMPLE_ONE
64d0353b83SRuslan Ermilovis described below.
659a78dbdeSMike Pritchard.It Dv EXAMPLE_TWO
669a78dbdeSMike PritchardSecond example.
679a78dbdeSMike Pritchard.El
689a78dbdeSMike Pritchard.Pp
69d72ca9ddSRuslan ErmilovThe above values are defined in
70fe08efe6SRuslan Ermilov.In example.h
719a78dbdeSMike Pritchardas follows:
729a78dbdeSMike Pritchard.Bd -literal
739a78dbdeSMike Pritchard#define EXAMPLE_ONE  1
749a78dbdeSMike Pritchard#define EXAMPLE_TWO  2
759a78dbdeSMike Pritchard.Ed
76ed0bfbe5SMike Pritchard.Sh IMPLEMENTATION NOTES
77ed0bfbe5SMike PritchardThe
78ed0bfbe5SMike Pritchard.Fn example
79ed0bfbe5SMike Pritchardfunction is not actually implemented.
809a78dbdeSMike Pritchard.Sh RETURN VALUES
81a238c207SMike Pritchard.Rv -std example
829a78dbdeSMike Pritchard.Sh ENVIRONMENT
839a78dbdeSMike PritchardThe
849a78dbdeSMike Pritchard.Fn example
859a78dbdeSMike Pritchardlibrary function ignores the
869a78dbdeSMike Pritchard.Ev EXAMPLE
879a78dbdeSMike Pritchardenvironment variable.
889a78dbdeSMike Pritchard.Sh FILES
89d72ca9ddSRuslan Ermilov.Bl -tag -width ".Pa /dev/null" -compact
909a78dbdeSMike Pritchard.It Pa /dev/null
919a78dbdeSMike PritchardExample of a file in the
929a78dbdeSMike Pritchard.Sx FILES
939a78dbdeSMike Pritchardsection.
949a78dbdeSMike Pritchard.El
959a78dbdeSMike Pritchard.Sh DIAGNOSTICS
969a78dbdeSMike PritchardNone.
97ed0bfbe5SMike Pritchard.Sh COMPATIBILITY
98ed0bfbe5SMike PritchardThe
99ed0bfbe5SMike Pritchard.Fn example
100ed0bfbe5SMike Pritchardfunction has no known compatibility issues.
1019a78dbdeSMike Pritchard.Sh ERRORS
10281fba91bSMike Pritchard.\" Delete any errno's that are not returned by your
10381fba91bSMike Pritchard.\" function or system call and then tailor the
10481fba91bSMike Pritchard.\" remaining text as needed.
105c0cfe3daSRuslan ErmilovThe
106c0cfe3daSRuslan Ermilov.Fn example
107c0cfe3daSRuslan Ermilovfunction will fail if:
1089a78dbdeSMike Pritchard.Bl -tag -width Er
1099a78dbdeSMike Pritchard.It Bq Er EPERM
11081fba91bSMike PritchardOperation not permitted.
11181fba91bSMike Pritchard.It Bq Er ENOENT
11281fba91bSMike PritchardNo such file or directory.
11381fba91bSMike Pritchard.It Bq Er ESRCH
11481fba91bSMike PritchardNo such process.
11581fba91bSMike Pritchard.It Bq Er EINTR
11681fba91bSMike PritchardInterrupted system call.
11781fba91bSMike Pritchard.It Bq Er EIO
11881fba91bSMike PritchardInput/output error.
11981fba91bSMike Pritchard.It Bq Er ENXIO
12081fba91bSMike PritchardDevice not configured.
12181fba91bSMike Pritchard.It Bq Er E2BIG
12281fba91bSMike PritchardArgument list too long.
12381fba91bSMike Pritchard.It Bq Er ENOEXEC
12481fba91bSMike PritchardExec format error.
12581fba91bSMike Pritchard.It Bq Er EBADF
12681fba91bSMike PritchardBad file descriptor.
12781fba91bSMike Pritchard.It Bq Er ECHILD
12881fba91bSMike PritchardNo child processes.
12981fba91bSMike Pritchard.It Bq Er EDEADLK
13081fba91bSMike PritchardResource deadlock avoided.
13181fba91bSMike Pritchard.It Bq Er ENOMEM
13281fba91bSMike PritchardCannot allocate memory.
13381fba91bSMike Pritchard.It Bq Er EACCES
13481fba91bSMike PritchardPermission denied.
13581fba91bSMike Pritchard.It Bq Er EFAULT
13681fba91bSMike PritchardBad address.
13781fba91bSMike Pritchard.It Bq Er ENOTBLK
13881fba91bSMike PritchardBlock device required.
13981fba91bSMike Pritchard.It Bq Er EBUSY
14081fba91bSMike PritchardDevice busy.
14181fba91bSMike Pritchard.It Bq Er EEXIST
14281fba91bSMike PritchardFile exists.
14381fba91bSMike Pritchard.It Bq Er EXDEV
14481fba91bSMike PritchardCross-device link.
14581fba91bSMike Pritchard.It Bq Er ENODEV
14681fba91bSMike PritchardOperation not supported by device.
14781fba91bSMike Pritchard.It Bq Er ENOTDIR
14881fba91bSMike PritchardNot a directory.
14981fba91bSMike Pritchard.It Bq Er EISDIR
15081fba91bSMike PritchardIs a directory.
15181fba91bSMike Pritchard.It Bq Er EINVAL
15281fba91bSMike PritchardInvalid argument.
15381fba91bSMike Pritchard.It Bq Er ENFILE
15481fba91bSMike PritchardToo many open files in system.
15581fba91bSMike Pritchard.It Bq Er EMFILE
15681fba91bSMike PritchardToo many open files.
15781fba91bSMike Pritchard.It Bq Er ENOTTY
15881fba91bSMike PritchardInappropriate ioctl for device.
15981fba91bSMike Pritchard.It Bq Er ETXTBSY
16081fba91bSMike PritchardText file busy.
16181fba91bSMike Pritchard.It Bq Er EFBIG
16281fba91bSMike PritchardFile too large.
16381fba91bSMike Pritchard.It Bq Er ENOSPC
16481fba91bSMike PritchardNo space left on device.
16581fba91bSMike Pritchard.It Bq Er ESPIPE
16681fba91bSMike PritchardIllegal seek.
16781fba91bSMike Pritchard.It Bq Er EROFS
16881fba91bSMike PritchardRead-only file system.
16981fba91bSMike Pritchard.It Bq Er EMLINK
17081fba91bSMike PritchardToo many links.
17181fba91bSMike Pritchard.It Bq Er EPIPE
17281fba91bSMike PritchardBroken pipe.
17381fba91bSMike Pritchard.It Bq Er EDOM
17481fba91bSMike PritchardNumerical argument out of domain.
17581fba91bSMike Pritchard.It Bq Er ERANGE
17681fba91bSMike PritchardResult too large.
17781fba91bSMike Pritchard.It Bq Er EAGAIN
17881fba91bSMike PritchardResource temporarily unavailable.
17981fba91bSMike Pritchard.It Bq Er EWOULDBLOCK
18081fba91bSMike PritchardOperation would block.
18181fba91bSMike Pritchard.It Bq Er EINPROGRESS
18281fba91bSMike PritchardOperation now in progress.
18381fba91bSMike Pritchard.It Bq Er EALREADY
18481fba91bSMike PritchardOperation already in progress.
18581fba91bSMike Pritchard.It Bq Er ENOTSOCK
18681fba91bSMike PritchardSocket operation on non-socket.
18781fba91bSMike Pritchard.It Bq Er EDESTADDRREQ
18881fba91bSMike PritchardDestination address required.
18981fba91bSMike Pritchard.It Bq Er EMSGSIZE
19081fba91bSMike PritchardMessage too long.
19181fba91bSMike Pritchard.It Bq Er EPROTOTYPE
19281fba91bSMike PritchardProtocol wrong type for socket.
19381fba91bSMike Pritchard.It Bq Er ENOPROTOOPT
19481fba91bSMike PritchardProtocol not available.
19581fba91bSMike Pritchard.It Bq Er EPROTONOSUPPORT
19681fba91bSMike PritchardProtocol not supported.
197b92a189eSRuslan Ermilov.It Bq Er ESOCKTNOSUPPORT
19881fba91bSMike PritchardSocket type not supported.
19981fba91bSMike Pritchard.It Bq Er EOPNOTSUPP
20081fba91bSMike PritchardOperation not supported.
20181fba91bSMike Pritchard.It Bq Er EPFNOSUPPORT
20281fba91bSMike PritchardProtocol family not supported.
203b92a189eSRuslan Ermilov.It Bq Er EAFNOSUPPORT
20481fba91bSMike PritchardAddress family not supported by protocol family.
20581fba91bSMike Pritchard.It Bq Er EADDRINUSE
20681fba91bSMike PritchardAddress already in use.
20781fba91bSMike Pritchard.It Bq Er EADDRNOTAVAIL
20881fba91bSMike PritchardCannot assign requested address.
20981fba91bSMike Pritchard.It Bq Er ENETDOWN
21081fba91bSMike PritchardNetwork is down.
21181fba91bSMike Pritchard.It Bq Er ENETUNREACH
21281fba91bSMike PritchardNetwork is unreachable.
21381fba91bSMike Pritchard.It Bq Er ENETRESET
21481fba91bSMike PritchardNetwork dropped connection on reset.
21581fba91bSMike Pritchard.It Bq Er ECONNABORTED
21681fba91bSMike PritchardSoftware causes connection abort.
21781fba91bSMike Pritchard.It Bq Er ENOBUFS
21881fba91bSMike PritchardNo buffer space available.
21981fba91bSMike Pritchard.It Bq Er EISCONN
22081fba91bSMike PritchardSocket is already connected.
22181fba91bSMike Pritchard.It Bq Er ENOTCONN
22281fba91bSMike PritchardSocket is not connected.
22381fba91bSMike Pritchard.It Bq Er ESHUTDOWN
22481fba91bSMike PritchardCannot send after socket shutdown.
22581fba91bSMike Pritchard.It Bq Er ETOOMANYREFS
22681fba91bSMike PritchardToo many references: cannot splice.
22781fba91bSMike Pritchard.It Bq Er ETIMEDOUT
22881fba91bSMike PritchardOperation timed out.
22981fba91bSMike Pritchard.It Bq Er ECONNREFUSED
23081fba91bSMike PritchardConnection refused.
23181fba91bSMike Pritchard.It Bq Er ELOOP
23281fba91bSMike PritchardToo many levels of symbolic links.
23381fba91bSMike Pritchard.It Bq Er ENAMETOOLONG
23481fba91bSMike PritchardFile name too long.
23581fba91bSMike Pritchard.It Bq Er EHOSTDOWN
23681fba91bSMike PritchardHost is down.
23781fba91bSMike Pritchard.It Bq Er EHOSTUNREACH
23881fba91bSMike PritchardNo route to host.
23981fba91bSMike Pritchard.It Bq Er ENOTEMPTY
24081fba91bSMike PritchardDirectory not empty.
24181fba91bSMike Pritchard.It Bq Er EPROCLIM
24281fba91bSMike PritchardToo many processes.
24381fba91bSMike Pritchard.It Bq Er EUSERS
24481fba91bSMike PritchardToo many users.
24581fba91bSMike Pritchard.It Bq Er EDQUOT
24681fba91bSMike PritchardDisc quota exceeded.
24781fba91bSMike Pritchard.It Bq Er ESTALE
24881fba91bSMike PritchardStale NFS file handle.
24981fba91bSMike Pritchard.It Bq Er EREMOTE
25081fba91bSMike PritchardToo many levels of remote in path.
25181fba91bSMike Pritchard.It Bq Er EBADRPC
25281fba91bSMike PritchardRPC struct is bad.
25381fba91bSMike Pritchard.It Bq Er ERPCMISMATCH
25481fba91bSMike PritchardRPC version wrong.
25581fba91bSMike Pritchard.It Bq Er EPROGUNAVAIL
25681fba91bSMike PritchardRPC program not available.
25781fba91bSMike Pritchard.It Bq Er EPROGMISMATCH
25881fba91bSMike PritchardProgram version wrong.
25981fba91bSMike Pritchard.It Bq Er EPROCUNAVAIL
26081fba91bSMike PritchardBad procedure for program.
26181fba91bSMike Pritchard.It Bq Er ENOLCK
26281fba91bSMike PritchardNo locks available.
26381fba91bSMike Pritchard.It Bq Er ENOSYS
26481fba91bSMike PritchardFunction not implemented.
26581fba91bSMike Pritchard.It Bq Er EFTYPE
26681fba91bSMike PritchardInappropriate file type or format.
26781fba91bSMike Pritchard.It Bq Er EAUTH
26881fba91bSMike PritchardAuthentication error.
26981fba91bSMike Pritchard.It Bq Er ENEEDAUTH
27081fba91bSMike PritchardNeed authenticator.
2718caf8b17SMike Pritchard.It Bq Er EIDRM
272c0cfe3daSRuslan ErmilovIdentifier removed.
27304910956SMike Pritchard.It Bq Er ENOMSG
274c0cfe3daSRuslan ErmilovNo message of desired type.
27504910956SMike Pritchard.It Bq Er EOVERFLOW
276c0cfe3daSRuslan ErmilovValue too large to be stored in data type.
27704910956SMike Pritchard.It Bq Er ECANCELED
278c0cfe3daSRuslan ErmilovOperation canceled.
27904910956SMike Pritchard.It Bq Er EILSEQ
280c0cfe3daSRuslan ErmilovIllegal byte sequence.
28104910956SMike Pritchard.It Bq Er ENOATTR
282c0cfe3daSRuslan ErmilovAttribute not found.
28304910956SMike Pritchard.It Bq Er EDOOFUS
284c0cfe3daSRuslan ErmilovProgramming error.
2859a78dbdeSMike Pritchard.El
286ed0bfbe5SMike Pritchard.Sh SEE ALSO
287ed0bfbe5SMike Pritchard.Xr example 1 ,
288ed0bfbe5SMike Pritchard.Xr example 4 ,
2894227c68dSGiorgos Keramidas.Xr mdoc 7 ,
2904227c68dSGiorgos Keramidas.Xr example 9
291ed0bfbe5SMike Pritchard.Rs
292d72ca9ddSRuslan Ermilov.%A "A. B. Author"
293d72ca9ddSRuslan Ermilov.%T "Example RFC Title"
294ed0bfbe5SMike Pritchard.%O RFC0000
295ed0bfbe5SMike Pritchard.Re
296ed0bfbe5SMike Pritchard.Rs
297d72ca9ddSRuslan Ermilov.%A "A. B. Author"
298d72ca9ddSRuslan Ermilov.%B "Example Book Title"
299ed0bfbe5SMike Pritchard.%O ISBN-0-000-00000-0
300ed0bfbe5SMike Pritchard.Re
301ed0bfbe5SMike Pritchard.Rs
302d72ca9ddSRuslan Ermilov.%A "A. B. Author"
303d72ca9ddSRuslan Ermilov.%D "January 1997"
304d72ca9ddSRuslan Ermilov.%J "Example Journal Name"
305d72ca9ddSRuslan Ermilov.%T "Example Article Title"
306ed0bfbe5SMike Pritchard.Re
307ed0bfbe5SMike Pritchard.Sh STANDARDS
308c0cfe3daSRuslan ErmilovIf the function conforms to some standard, such as
30924c875f9SRuslan Ermilov.St -p1003.1-2004
310ed0bfbe5SMike Pritchardor
311c0cfe3daSRuslan Ermilov.St -isoC-99 ,
312ed0bfbe5SMike Pritchardit should be noted here.
3139a78dbdeSMike Pritchard.Sh HISTORY
3149a78dbdeSMike PritchardThe
3159a78dbdeSMike Pritchard.Nm
3169a78dbdeSMike Pritchardmanual page example first appeared in
3179cb8091fSMike Pritchard.Fx 2.2 .
31881fba91bSMike Pritchard.Pp
31981fba91bSMike PritchardSome other common
32081fba91bSMike Pritchard.Sx HISTORY
32181fba91bSMike Pritchardsection examples are:
32281fba91bSMike Pritchard.Pp
32381fba91bSMike PritchardThe
32481fba91bSMike Pritchard.Nm
32581fba91bSMike Pritchardmanual page example first appeared in
32681fba91bSMike Pritchard.Bx 4.4 .
32781fba91bSMike Pritchard.Pp
32881fba91bSMike PritchardThe
32981fba91bSMike Pritchard.Nm
33081fba91bSMike Pritchardmanual page example first appeared in
33181fba91bSMike Pritchard.At v6 .
332facbd487SPhilippe Charnier.Sh AUTHORS
3339a78dbdeSMike PritchardThis
334d00f4c32SMike Pritchardmanual page was written by
335bd0891ceSBaptiste Daroussin.An Mike Pritchard Aq Mt mpp@FreeBSD.org .
3369a78dbdeSMike Pritchard.Sh BUGS
3379a78dbdeSMike PritchardThe actual code for this function is vaporware.
338