xref: /freebsd/share/examples/mdoc/example.3 (revision d0353b836e88609b9400851d32e0aa6645ff9be3)
1374334e4SBruce Evans.\" Copyright (c) [year] [your name]
2374334e4SBruce Evans.\" All rights reserved.
39a78dbdeSMike Pritchard.\"
49a78dbdeSMike Pritchard.\" Redistribution and use in source and binary forms, with or without
59a78dbdeSMike Pritchard.\" modification, are permitted provided that the following conditions
69a78dbdeSMike Pritchard.\" are met:
79a78dbdeSMike Pritchard.\" 1. Redistributions of source code must retain the above copyright
89a78dbdeSMike Pritchard.\"    notice, this list of conditions and the following disclaimer.
99a78dbdeSMike Pritchard.\" 2. Redistributions in binary form must reproduce the above copyright
109a78dbdeSMike Pritchard.\"    notice, this list of conditions and the following disclaimer in the
119a78dbdeSMike Pritchard.\"    documentation and/or other materials provided with the distribution.
129a78dbdeSMike Pritchard.\"
13374334e4SBruce Evans.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
149a78dbdeSMike Pritchard.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
159a78dbdeSMike Pritchard.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
169a78dbdeSMike Pritchard.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
179a78dbdeSMike Pritchard.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
189a78dbdeSMike Pritchard.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
199a78dbdeSMike Pritchard.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
209a78dbdeSMike Pritchard.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
219a78dbdeSMike Pritchard.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
229a78dbdeSMike Pritchard.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
239a78dbdeSMike Pritchard.\" SUCH DAMAGE.
249a78dbdeSMike Pritchard.\"
257dc5a4daSMike Pritchard.\" $FreeBSD$
267dc5a4daSMike Pritchard.\" Note: All FreeBSD man pages should have a FreeBSD revision
277dc5a4daSMike Pritchard.\" control id to make it easier for translation teams to track
287dc5a4daSMike Pritchard.\" changes.
299a78dbdeSMike Pritchard.\"
3081fba91bSMike Pritchard.\" Note: The date here should be updated whenever a non-trivial
3181fba91bSMike Pritchard.\" change is made to the manual page.
32ed0bfbe5SMike Pritchard.Dd December 8, 1999
339a78dbdeSMike Pritchard.Dt EXAMPLE 3
349a78dbdeSMike Pritchard.\" Note: Only specify the operating system when the command
359a78dbdeSMike Pritchard.\" is FreeBSD specific, otherwise use the .Os macro with no
369a78dbdeSMike Pritchard.\" arguments.
37ed403116SRuslan Ermilov.Os FreeBSD
389a78dbdeSMike Pritchard.Sh NAME
399a78dbdeSMike Pritchard.Nm example
409a78dbdeSMike Pritchard.Nd example library function manual page
410d2332f2SAlexey Zelkin.Sh LIBRARY
420d2332f2SAlexey Zelkin.\" Note: list of available libraries is available in mdoc.samples(7)
430d2332f2SAlexey Zelkin.Lb libc
449a78dbdeSMike Pritchard.Sh SYNOPSIS
459a78dbdeSMike Pritchard.Fd #include <example.h>
469a78dbdeSMike Pritchard.Ft int
479a78dbdeSMike Pritchard.Fn example "char *ptr" "int mode"
489a78dbdeSMike Pritchard.Sh DESCRIPTION
499a78dbdeSMike PritchardThis is an example library function manual page for
509a78dbdeSMike Pritchardthe
519a78dbdeSMike Pritchard.Fn example
529a78dbdeSMike Pritchardfunction.  It is intended
539a78dbdeSMike Pritchardthat this example can be used as a template when writing
549a78dbdeSMike Pritcharda new manual page.
559a78dbdeSMike Pritchard.Pp
569a78dbdeSMike PritchardThe
579a78dbdeSMike Pritchard.Fn example
589a78dbdeSMike Pritchardfunction takes two arguments:
599a78dbdeSMike Pritchard.Fa ptr
609a78dbdeSMike Pritchardand
619a78dbdeSMike Pritchard.Fa mode .
629a78dbdeSMike PritchardThe argument
639a78dbdeSMike Pritchard.Fa mode
649a78dbdeSMike Pritchardmay have one of the following values:
659a78dbdeSMike Pritchard.Bl -tag -width EXAMPLE_ONE
669a78dbdeSMike Pritchard.It Dv EXAMPLE_ONE
679a78dbdeSMike PritchardFirst example of a defined variable.
68d0353b83SRuslan Ermilov.Dv EXAMPLE_ONE
69d0353b83SRuslan Ermilovis described below.
709a78dbdeSMike Pritchard.It Dv EXAMPLE_TWO
719a78dbdeSMike PritchardSecond example.
729a78dbdeSMike Pritchard.El
739a78dbdeSMike Pritchard.Pp
749a78dbdeSMike PritchardThe above value are defined in
75c13b19beSMike Pritchard.Aq Pa example.h
769a78dbdeSMike Pritchardas follows:
779a78dbdeSMike Pritchard.Bd -literal
789a78dbdeSMike Pritchard#define EXAMPLE_ONE  1
799a78dbdeSMike Pritchard#define EXAMPLE_TWO  2
809a78dbdeSMike Pritchard.Ed
81ed0bfbe5SMike Pritchard.Sh IMPLEMENTATION NOTES
82ed0bfbe5SMike PritchardThe
83ed0bfbe5SMike Pritchard.Fn example
84ed0bfbe5SMike Pritchardfunction is not actually implemented.
859a78dbdeSMike Pritchard.Sh RETURN VALUES
86a238c207SMike Pritchard.Rv -std example
879a78dbdeSMike Pritchard.Sh ENVIRONMENT
889a78dbdeSMike PritchardThe
899a78dbdeSMike Pritchard.Fn example
909a78dbdeSMike Pritchardlibrary function ignores the
919a78dbdeSMike Pritchard.Ev EXAMPLE
929a78dbdeSMike Pritchardenvironment variable.
939a78dbdeSMike Pritchard.Sh FILES
949a78dbdeSMike Pritchard.Bl -tag -width /dev/null -compact
959a78dbdeSMike Pritchard.It Pa /dev/null
969a78dbdeSMike PritchardExample of a file in the
979a78dbdeSMike Pritchard.Sx FILES
989a78dbdeSMike Pritchardsection.
999a78dbdeSMike Pritchard.El
1009a78dbdeSMike Pritchard.Sh DIAGNOSTICS
1019a78dbdeSMike PritchardNone.
102ed0bfbe5SMike Pritchard.Sh COMPATIBILITY
103ed0bfbe5SMike PritchardThe
104ed0bfbe5SMike Pritchard.Fn example
105ed0bfbe5SMike Pritchardfunction has no known compatibility issues.
1069a78dbdeSMike Pritchard.Sh ERRORS
10781fba91bSMike Pritchard.\" Delete any errno's that are not returned by your
10881fba91bSMike Pritchard.\" function or system call and then tailor the
10981fba91bSMike Pritchard.\" remaining text as needed.
1109a78dbdeSMike Pritchard.Fn Example
1119a78dbdeSMike Pritchardwill fail if:
1129a78dbdeSMike Pritchard.Bl -tag -width Er
1139a78dbdeSMike Pritchard.It Bq Er EPERM
11481fba91bSMike PritchardOperation not permitted.
11581fba91bSMike Pritchard.It Bq Er ENOENT
11681fba91bSMike PritchardNo such file or directory.
11781fba91bSMike Pritchard.It Bq Er ESRCH
11881fba91bSMike PritchardNo such process.
11981fba91bSMike Pritchard.It Bq Er EINTR
12081fba91bSMike PritchardInterrupted system call.
12181fba91bSMike Pritchard.It Bq Er EIO
12281fba91bSMike PritchardInput/output error.
12381fba91bSMike Pritchard.It Bq Er ENXIO
12481fba91bSMike PritchardDevice not configured.
12581fba91bSMike Pritchard.It Bq Er E2BIG
12681fba91bSMike PritchardArgument list too long.
12781fba91bSMike Pritchard.It Bq Er ENOEXEC
12881fba91bSMike PritchardExec format error.
12981fba91bSMike Pritchard.It Bq Er EBADF
13081fba91bSMike PritchardBad file descriptor.
13181fba91bSMike Pritchard.It Bq Er ECHILD
13281fba91bSMike PritchardNo child processes.
13381fba91bSMike Pritchard.It Bq Er EDEADLK
13481fba91bSMike PritchardResource deadlock avoided.
13581fba91bSMike Pritchard.It Bq Er ENOMEM
13681fba91bSMike PritchardCannot allocate memory.
13781fba91bSMike Pritchard.It Bq Er EACCES
13881fba91bSMike PritchardPermission denied.
13981fba91bSMike Pritchard.It Bq Er EFAULT
14081fba91bSMike PritchardBad address.
14181fba91bSMike Pritchard.It Bq Er ENOTBLK
14281fba91bSMike PritchardBlock device required.
14381fba91bSMike Pritchard.It Bq Er EBUSY
14481fba91bSMike PritchardDevice busy.
14581fba91bSMike Pritchard.It Bq Er EEXIST
14681fba91bSMike PritchardFile exists.
14781fba91bSMike Pritchard.It Bq Er EXDEV
14881fba91bSMike PritchardCross-device link.
14981fba91bSMike Pritchard.It Bq Er ENODEV
15081fba91bSMike PritchardOperation not supported by device.
15181fba91bSMike Pritchard.It Bq Er ENOTDIR
15281fba91bSMike PritchardNot a directory.
15381fba91bSMike Pritchard.It Bq Er EISDIR
15481fba91bSMike PritchardIs a directory.
15581fba91bSMike Pritchard.It Bq Er EINVAL
15681fba91bSMike PritchardInvalid argument.
15781fba91bSMike Pritchard.It Bq Er ENFILE
15881fba91bSMike PritchardToo many open files in system.
15981fba91bSMike Pritchard.It Bq Er EMFILE
16081fba91bSMike PritchardToo many open files.
16181fba91bSMike Pritchard.It Bq Er ENOTTY
16281fba91bSMike PritchardInappropriate ioctl for device.
16381fba91bSMike Pritchard.It Bq Er ETXTBSY
16481fba91bSMike PritchardText file busy.
16581fba91bSMike Pritchard.It Bq Er EFBIG
16681fba91bSMike PritchardFile too large.
16781fba91bSMike Pritchard.It Bq Er ENOSPC
16881fba91bSMike PritchardNo space left on device.
16981fba91bSMike Pritchard.It Bq Er ESPIPE
17081fba91bSMike PritchardIllegal seek.
17181fba91bSMike Pritchard.It Bq Er EROFS
17281fba91bSMike PritchardRead-only file system.
17381fba91bSMike Pritchard.It Bq Er EMLINK
17481fba91bSMike PritchardToo many links.
17581fba91bSMike Pritchard.It Bq Er EPIPE
17681fba91bSMike PritchardBroken pipe.
17781fba91bSMike Pritchard.It Bq Er EDOM
17881fba91bSMike PritchardNumerical argument out of domain.
17981fba91bSMike Pritchard.It Bq Er ERANGE
18081fba91bSMike PritchardResult too large.
18181fba91bSMike Pritchard.It Bq Er EAGAIN
18281fba91bSMike PritchardResource temporarily unavailable.
18381fba91bSMike Pritchard.It Bq Er EWOULDBLOCK
18481fba91bSMike PritchardOperation would block.
18581fba91bSMike Pritchard.It Bq Er EINPROGRESS
18681fba91bSMike PritchardOperation now in progress.
18781fba91bSMike Pritchard.It Bq Er EALREADY
18881fba91bSMike PritchardOperation already in progress.
18981fba91bSMike Pritchard.It Bq Er ENOTSOCK
19081fba91bSMike PritchardSocket operation on non-socket.
19181fba91bSMike Pritchard.It Bq Er EDESTADDRREQ
19281fba91bSMike PritchardDestination address required.
19381fba91bSMike Pritchard.It Bq Er EMSGSIZE
19481fba91bSMike PritchardMessage too long.
19581fba91bSMike Pritchard.It Bq Er EPROTOTYPE
19681fba91bSMike PritchardProtocol wrong type for socket.
19781fba91bSMike Pritchard.It Bq Er ENOPROTOOPT
19881fba91bSMike PritchardProtocol not available.
19981fba91bSMike Pritchard.It Bq Er EPROTONOSUPPORT
20081fba91bSMike PritchardProtocol not supported.
201b92a189eSRuslan Ermilov.It Bq Er ESOCKTNOSUPPORT
20281fba91bSMike PritchardSocket type not supported.
20381fba91bSMike Pritchard.It Bq Er EOPNOTSUPP
20481fba91bSMike PritchardOperation not supported.
20581fba91bSMike Pritchard.It Bq Er EPFNOSUPPORT
20681fba91bSMike PritchardProtocol family not supported.
207b92a189eSRuslan Ermilov.It Bq Er EAFNOSUPPORT
20881fba91bSMike PritchardAddress family not supported by protocol family.
20981fba91bSMike Pritchard.It Bq Er EADDRINUSE
21081fba91bSMike PritchardAddress already in use.
21181fba91bSMike Pritchard.It Bq Er EADDRNOTAVAIL
21281fba91bSMike PritchardCannot assign requested address.
21381fba91bSMike Pritchard.It Bq Er ENETDOWN
21481fba91bSMike PritchardNetwork is down.
21581fba91bSMike Pritchard.It Bq Er ENETUNREACH
21681fba91bSMike PritchardNetwork is unreachable.
21781fba91bSMike Pritchard.It Bq Er ENETRESET
21881fba91bSMike PritchardNetwork dropped connection on reset.
21981fba91bSMike Pritchard.It Bq Er ECONNABORTED
22081fba91bSMike PritchardSoftware causes connection abort.
22181fba91bSMike Pritchard.It Bq Er ENOBUFS
22281fba91bSMike PritchardNo buffer space available.
22381fba91bSMike Pritchard.It Bq Er EISCONN
22481fba91bSMike PritchardSocket is already connected.
22581fba91bSMike Pritchard.It Bq Er ENOTCONN
22681fba91bSMike PritchardSocket is not connected.
22781fba91bSMike Pritchard.It Bq Er ESHUTDOWN
22881fba91bSMike PritchardCannot send after socket shutdown.
22981fba91bSMike Pritchard.It Bq Er ETOOMANYREFS
23081fba91bSMike PritchardToo many references:  cannot splice.
23181fba91bSMike Pritchard.It Bq Er ETIMEDOUT
23281fba91bSMike PritchardOperation timed out.
23381fba91bSMike Pritchard.It Bq Er ECONNREFUSED
23481fba91bSMike PritchardConnection refused.
23581fba91bSMike Pritchard.It Bq Er ELOOP
23681fba91bSMike PritchardToo many levels of symbolic links.
23781fba91bSMike Pritchard.It Bq Er ENAMETOOLONG
23881fba91bSMike PritchardFile name too long.
23981fba91bSMike Pritchard.It Bq Er EHOSTDOWN
24081fba91bSMike PritchardHost is down.
24181fba91bSMike Pritchard.It Bq Er EHOSTUNREACH
24281fba91bSMike PritchardNo route to host.
24381fba91bSMike Pritchard.It Bq Er ENOTEMPTY
24481fba91bSMike PritchardDirectory not empty.
24581fba91bSMike Pritchard.It Bq Er EPROCLIM
24681fba91bSMike PritchardToo many processes.
24781fba91bSMike Pritchard.It Bq Er EUSERS
24881fba91bSMike PritchardToo many users.
24981fba91bSMike Pritchard.It Bq Er EDQUOT
25081fba91bSMike PritchardDisc quota exceeded.
25181fba91bSMike Pritchard.It Bq Er ESTALE
25281fba91bSMike PritchardStale NFS file handle.
25381fba91bSMike Pritchard.It Bq Er EREMOTE
25481fba91bSMike PritchardToo many levels of remote in path.
25581fba91bSMike Pritchard.It Bq Er EBADRPC
25681fba91bSMike PritchardRPC struct is bad.
25781fba91bSMike Pritchard.It Bq Er ERPCMISMATCH
25881fba91bSMike PritchardRPC version wrong.
25981fba91bSMike Pritchard.It Bq Er EPROGUNAVAIL
26081fba91bSMike PritchardRPC program not available.
26181fba91bSMike Pritchard.It Bq Er EPROGMISMATCH
26281fba91bSMike PritchardProgram version wrong.
26381fba91bSMike Pritchard.It Bq Er EPROCUNAVAIL
26481fba91bSMike PritchardBad procedure for program.
26581fba91bSMike Pritchard.It Bq Er ENOLCK
26681fba91bSMike PritchardNo locks available.
26781fba91bSMike Pritchard.It Bq Er ENOSYS
26881fba91bSMike PritchardFunction not implemented.
26981fba91bSMike Pritchard.It Bq Er EFTYPE
27081fba91bSMike PritchardInappropriate file type or format.
27181fba91bSMike Pritchard.It Bq Er EAUTH
27281fba91bSMike PritchardAuthentication error.
27381fba91bSMike Pritchard.It Bq Er ENEEDAUTH
27481fba91bSMike PritchardNeed authenticator.
2759a78dbdeSMike Pritchard.El
276ed0bfbe5SMike Pritchard.Sh SEE ALSO
277ed0bfbe5SMike Pritchard.Xr example 1 ,
278ed0bfbe5SMike Pritchard.Xr example 4 ,
279ed0bfbe5SMike Pritchard.Xr mdoc 7 ,
280ed0bfbe5SMike Pritchard.Xr mdoc.samples 7
281ed0bfbe5SMike Pritchard.Rs
282ed0bfbe5SMike Pritchard.%A A. B. Author
283ed0bfbe5SMike Pritchard.%T Example RFC Title
284ed0bfbe5SMike Pritchard.%O RFC0000
285ed0bfbe5SMike Pritchard.Re
286ed0bfbe5SMike Pritchard.Rs
287ed0bfbe5SMike Pritchard.%A A. B. Author
288ed0bfbe5SMike Pritchard.%B Example Book Title
289ed0bfbe5SMike Pritchard.%O ISBN-0-000-00000-0
290ed0bfbe5SMike Pritchard.Re
291ed0bfbe5SMike Pritchard.Rs
292ed0bfbe5SMike Pritchard.%A A. B. Author
293ed0bfbe5SMike Pritchard.%D January 1997
294ed0bfbe5SMike Pritchard.%J Example Journal Name
295ed0bfbe5SMike Pritchard.%T Example Article Title
296ed0bfbe5SMike Pritchard.Re
297ed0bfbe5SMike Pritchard.Sh STANDARDS
298ed0bfbe5SMike PritchardIf the command conforms to some standard, such as
299ed0bfbe5SMike Pritchard.St -p1003.2
300ed0bfbe5SMike Pritchardor
301ed0bfbe5SMike Pritchard.St -ansiC ,
302ed0bfbe5SMike Pritchardit should be noted here.
3039a78dbdeSMike Pritchard.Sh HISTORY
3049a78dbdeSMike PritchardThe
3059a78dbdeSMike Pritchard.Nm
3069a78dbdeSMike Pritchardmanual page example first appeared in
3079cb8091fSMike Pritchard.Fx 2.2 .
30881fba91bSMike Pritchard.Pp
30981fba91bSMike PritchardSome other common
31081fba91bSMike Pritchard.Sx HISTORY
31181fba91bSMike Pritchardsection examples are:
31281fba91bSMike Pritchard.Pp
31381fba91bSMike PritchardThe
31481fba91bSMike Pritchard.Nm
31581fba91bSMike Pritchardmanual page example first appeared in
31681fba91bSMike Pritchard.Bx 4.4 .
31781fba91bSMike Pritchard.Pp
31881fba91bSMike PritchardThe
31981fba91bSMike Pritchard.Nm
32081fba91bSMike Pritchardmanual page example first appeared in
32181fba91bSMike Pritchard.At v6 .
322facbd487SPhilippe Charnier.Sh AUTHORS
3239a78dbdeSMike PritchardThis
324d00f4c32SMike Pritchardmanual page was written by
325facbd487SPhilippe Charnier.An Mike Pritchard Aq mpp@FreeBSD.org .
3269a78dbdeSMike Pritchard.Sh BUGS
3279a78dbdeSMike PritchardThe actual code for this function is vaporware.
328