xref: /freebsd/share/examples/mdoc/example.3 (revision facbd4876f2bddec0fbf5ef4c0f757b02b72a1f3)
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.\"
25374334e4SBruce Evans.\"	[id for your version control system, if any]
269a78dbdeSMike Pritchard.\"
2781fba91bSMike Pritchard.\" Note: The date here should be updated whenever a non-trivial
2881fba91bSMike Pritchard.\" change is made to the manual page.
2981fba91bSMike Pritchard.Dd January 8, 1997
309a78dbdeSMike Pritchard.Dt EXAMPLE 3
319a78dbdeSMike Pritchard.\" Note: Only specify the operating system when the command
329a78dbdeSMike Pritchard.\" is FreeBSD specific, otherwise use the .Os macro with no
339a78dbdeSMike Pritchard.\" arguments.
349cb8091fSMike Pritchard.Os FreeBSD 2.2
359a78dbdeSMike Pritchard.Sh NAME
369a78dbdeSMike Pritchard.Nm example
379a78dbdeSMike Pritchard.Nd example library function manual page
389a78dbdeSMike Pritchard.Sh SYNOPSIS
399a78dbdeSMike Pritchard.Fd #include <example.h>
409a78dbdeSMike Pritchard.Ft int
419a78dbdeSMike Pritchard.Fn example "char *ptr" "int mode"
429a78dbdeSMike Pritchard.Sh DESCRIPTION
439a78dbdeSMike PritchardThis is an example library function manual page for
449a78dbdeSMike Pritchardthe
459a78dbdeSMike Pritchard.Fn example
469a78dbdeSMike Pritchardfunction.  It is intended
479a78dbdeSMike Pritchardthat this example can be used as a template when writing
489a78dbdeSMike Pritcharda new manual page.
499a78dbdeSMike Pritchard.Pp
509a78dbdeSMike PritchardThe
519a78dbdeSMike Pritchard.Fn example
529a78dbdeSMike Pritchardfunction takes two arguments:
539a78dbdeSMike Pritchard.Fa ptr
549a78dbdeSMike Pritchardand
559a78dbdeSMike Pritchard.Fa mode .
569a78dbdeSMike PritchardThe argument
579a78dbdeSMike Pritchard.Fa mode
589a78dbdeSMike Pritchardmay have one of the following values:
599a78dbdeSMike Pritchard.Bl -tag -width EXAMPLE_ONE
609a78dbdeSMike Pritchard.It Dv EXAMPLE_ONE
619a78dbdeSMike PritchardFirst example of a defined variable.
629a78dbdeSMike Pritchard.Dv EXAMPLE_ONE is described below.
639a78dbdeSMike Pritchard.It Dv EXAMPLE_TWO
649a78dbdeSMike PritchardSecond example.
659a78dbdeSMike Pritchard.El
669a78dbdeSMike Pritchard.Pp
679a78dbdeSMike PritchardThe above value are defined in
68c13b19beSMike Pritchard.Aq Pa example.h
699a78dbdeSMike Pritchardas follows:
709a78dbdeSMike Pritchard.Bd -literal
719a78dbdeSMike Pritchard#define EXAMPLE_ONE  1
729a78dbdeSMike Pritchard#define EXAMPLE_TWO  2
739a78dbdeSMike Pritchard.Ed
749a78dbdeSMike Pritchard.Sh RETURN VALUES
75a238c207SMike Pritchard.Rv -std example
769a78dbdeSMike Pritchard.Sh ENVIRONMENT
779a78dbdeSMike PritchardThe
789a78dbdeSMike Pritchard.Fn example
799a78dbdeSMike Pritchardlibrary function ignores the
809a78dbdeSMike Pritchard.Ev EXAMPLE
819a78dbdeSMike Pritchardenvironment variable.
829a78dbdeSMike Pritchard.Sh FILES
839a78dbdeSMike Pritchard.Bl -tag -width /dev/null -compact
849a78dbdeSMike Pritchard.It Pa /dev/null
859a78dbdeSMike PritchardExample of a file in the
869a78dbdeSMike Pritchard.Sx FILES
879a78dbdeSMike Pritchardsection.
889a78dbdeSMike Pritchard.El
899a78dbdeSMike Pritchard.Sh SEE ALSO
909a78dbdeSMike Pritchard.Xr example 1 ,
919a78dbdeSMike Pritchard.Xr example 4 ,
929a78dbdeSMike Pritchard.Xr mdoc 7 ,
939a78dbdeSMike Pritchard.Xr mdoc.samples 7
9481fba91bSMike Pritchard.Rs
9581fba91bSMike Pritchard.%A A. B. Author
9681fba91bSMike Pritchard.%T Example RFC Title
9781fba91bSMike Pritchard.%O RFC0000
9881fba91bSMike Pritchard.Re
9981fba91bSMike Pritchard.Rs
10081fba91bSMike Pritchard.%A A. B. Author
10181fba91bSMike Pritchard.%B Example Book Title
10281fba91bSMike Pritchard.%O ISBN-0-000-00000-0
10381fba91bSMike Pritchard.Re
10481fba91bSMike Pritchard.Rs
10581fba91bSMike Pritchard.%A A. B. Author
10681fba91bSMike Pritchard.%D January 1997
10781fba91bSMike Pritchard.%J Example Journal Name
10881fba91bSMike Pritchard.%T Example Article Title
10981fba91bSMike Pritchard.Re
1109a78dbdeSMike Pritchard.Sh STANDARDS
1119a78dbdeSMike PritchardIf the command conforms to some standard, such as
1129a78dbdeSMike Pritchard.St -p1003.2
1139a78dbdeSMike Pritchardor
1149a78dbdeSMike Pritchard.St -ansiC ,
1159a78dbdeSMike Pritchardit should be noted here.
1169a78dbdeSMike Pritchard.Sh DIAGNOSTICS
1179a78dbdeSMike PritchardNone.
1189a78dbdeSMike Pritchard.Sh ERRORS
11981fba91bSMike Pritchard.\" Delete any errno's that are not returned by your
12081fba91bSMike Pritchard.\" function or system call and then tailor the
12181fba91bSMike Pritchard.\" remaining text as needed.
1229a78dbdeSMike Pritchard.Fn Example
1239a78dbdeSMike Pritchardwill fail if:
1249a78dbdeSMike Pritchard.Bl -tag -width Er
1259a78dbdeSMike Pritchard.It Bq Er EPERM
12681fba91bSMike PritchardOperation not permitted.
12781fba91bSMike Pritchard.It Bq Er ENOENT
12881fba91bSMike PritchardNo such file or directory.
12981fba91bSMike Pritchard.It Bq Er ESRCH
13081fba91bSMike PritchardNo such process.
13181fba91bSMike Pritchard.It Bq Er EINTR
13281fba91bSMike PritchardInterrupted system call.
13381fba91bSMike Pritchard.It Bq Er EIO
13481fba91bSMike PritchardInput/output error.
13581fba91bSMike Pritchard.It Bq Er ENXIO
13681fba91bSMike PritchardDevice not configured.
13781fba91bSMike Pritchard.It Bq Er E2BIG
13881fba91bSMike PritchardArgument list too long.
13981fba91bSMike Pritchard.It Bq Er ENOEXEC
14081fba91bSMike PritchardExec format error.
14181fba91bSMike Pritchard.It Bq Er EBADF
14281fba91bSMike PritchardBad file descriptor.
14381fba91bSMike Pritchard.It Bq Er ECHILD
14481fba91bSMike PritchardNo child processes.
14581fba91bSMike Pritchard.It Bq Er EDEADLK
14681fba91bSMike PritchardResource deadlock avoided.
14781fba91bSMike Pritchard.It Bq Er ENOMEM
14881fba91bSMike PritchardCannot allocate memory.
14981fba91bSMike Pritchard.It Bq Er EACCES
15081fba91bSMike PritchardPermission denied.
15181fba91bSMike Pritchard.It Bq Er EFAULT
15281fba91bSMike PritchardBad address.
15381fba91bSMike Pritchard.It Bq Er ENOTBLK
15481fba91bSMike PritchardBlock device required.
15581fba91bSMike Pritchard.It Bq Er EBUSY
15681fba91bSMike PritchardDevice busy.
15781fba91bSMike Pritchard.It Bq Er EEXIST
15881fba91bSMike PritchardFile exists.
15981fba91bSMike Pritchard.It Bq Er EXDEV
16081fba91bSMike PritchardCross-device link.
16181fba91bSMike Pritchard.It Bq Er ENODEV
16281fba91bSMike PritchardOperation not supported by device.
16381fba91bSMike Pritchard.It Bq Er ENOTDIR
16481fba91bSMike PritchardNot a directory.
16581fba91bSMike Pritchard.It Bq Er EISDIR
16681fba91bSMike PritchardIs a directory.
16781fba91bSMike Pritchard.It Bq Er EINVAL
16881fba91bSMike PritchardInvalid argument.
16981fba91bSMike Pritchard.It Bq Er ENFILE
17081fba91bSMike PritchardToo many open files in system.
17181fba91bSMike Pritchard.It Bq Er EMFILE
17281fba91bSMike PritchardToo many open files.
17381fba91bSMike Pritchard.It Bq Er ENOTTY
17481fba91bSMike PritchardInappropriate ioctl for device.
17581fba91bSMike Pritchard.It Bq Er ETXTBSY
17681fba91bSMike PritchardText file busy.
17781fba91bSMike Pritchard.It Bq Er EFBIG
17881fba91bSMike PritchardFile too large.
17981fba91bSMike Pritchard.It Bq Er ENOSPC
18081fba91bSMike PritchardNo space left on device.
18181fba91bSMike Pritchard.It Bq Er ESPIPE
18281fba91bSMike PritchardIllegal seek.
18381fba91bSMike Pritchard.It Bq Er EROFS
18481fba91bSMike PritchardRead-only file system.
18581fba91bSMike Pritchard.It Bq Er EMLINK
18681fba91bSMike PritchardToo many links.
18781fba91bSMike Pritchard.It Bq Er EPIPE
18881fba91bSMike PritchardBroken pipe.
18981fba91bSMike Pritchard.It Bq Er EDOM
19081fba91bSMike PritchardNumerical argument out of domain.
19181fba91bSMike Pritchard.It Bq Er ERANGE
19281fba91bSMike PritchardResult too large.
19381fba91bSMike Pritchard.It Bq Er EAGAIN
19481fba91bSMike PritchardResource temporarily unavailable.
19581fba91bSMike Pritchard.It Bq Er EWOULDBLOCK
19681fba91bSMike PritchardOperation would block.
19781fba91bSMike Pritchard.It Bq Er EINPROGRESS
19881fba91bSMike PritchardOperation now in progress.
19981fba91bSMike Pritchard.It Bq Er EALREADY
20081fba91bSMike PritchardOperation already in progress.
20181fba91bSMike Pritchard.It Bq Er ENOTSOCK
20281fba91bSMike PritchardSocket operation on non-socket.
20381fba91bSMike Pritchard.It Bq Er EDESTADDRREQ
20481fba91bSMike PritchardDestination address required.
20581fba91bSMike Pritchard.It Bq Er EMSGSIZE
20681fba91bSMike PritchardMessage too long.
20781fba91bSMike Pritchard.It Bq Er EPROTOTYPE
20881fba91bSMike PritchardProtocol wrong type for socket.
20981fba91bSMike Pritchard.It Bq Er ENOPROTOOPT
21081fba91bSMike PritchardProtocol not available.
21181fba91bSMike Pritchard.It Bq Er EPROTONOSUPPORT
21281fba91bSMike PritchardProtocol not supported.
21381fba91bSMike Pritchard.It Bq Er ESOCKNOTSUPORT
21481fba91bSMike PritchardSocket type not supported.
21581fba91bSMike Pritchard.It Bq Er EOPNOTSUPP
21681fba91bSMike PritchardOperation not supported.
21781fba91bSMike Pritchard.It Bq Er EPFNOSUPPORT
21881fba91bSMike PritchardProtocol family not supported.
21981fba91bSMike Pritchard.It Bq Er EAFNNOSUPPORT
22081fba91bSMike PritchardAddress family not supported by protocol family.
22181fba91bSMike Pritchard.It Bq Er EADDRINUSE
22281fba91bSMike PritchardAddress already in use.
22381fba91bSMike Pritchard.It Bq Er EADDRNOTAVAIL
22481fba91bSMike PritchardCannot assign requested address.
22581fba91bSMike Pritchard.It Bq Er ENETDOWN
22681fba91bSMike PritchardNetwork is down.
22781fba91bSMike Pritchard.It Bq Er ENETUNREACH
22881fba91bSMike PritchardNetwork is unreachable.
22981fba91bSMike Pritchard.It Bq Er ENETRESET
23081fba91bSMike PritchardNetwork dropped connection on reset.
23181fba91bSMike Pritchard.It Bq Er ECONNABORTED
23281fba91bSMike PritchardSoftware causes connection abort.
23381fba91bSMike Pritchard.It Bq Er ENOBUFS
23481fba91bSMike PritchardNo buffer space available.
23581fba91bSMike Pritchard.It Bq Er EISCONN
23681fba91bSMike PritchardSocket is already connected.
23781fba91bSMike Pritchard.It Bq Er ENOTCONN
23881fba91bSMike PritchardSocket is not connected.
23981fba91bSMike Pritchard.It Bq Er ESHUTDOWN
24081fba91bSMike PritchardCannot send after socket shutdown.
24181fba91bSMike Pritchard.It Bq Er ETOOMANYREFS
24281fba91bSMike PritchardToo many references:  cannot splice.
24381fba91bSMike Pritchard.It Bq Er ETIMEDOUT
24481fba91bSMike PritchardOperation timed out.
24581fba91bSMike Pritchard.It Bq Er ECONNREFUSED
24681fba91bSMike PritchardConnection refused.
24781fba91bSMike Pritchard.It Bq Er ELOOP
24881fba91bSMike PritchardToo many levels of symbolic links.
24981fba91bSMike Pritchard.It Bq Er ENAMETOOLONG
25081fba91bSMike PritchardFile name too long.
25181fba91bSMike Pritchard.It Bq Er EHOSTDOWN
25281fba91bSMike PritchardHost is down.
25381fba91bSMike Pritchard.It Bq Er EHOSTUNREACH
25481fba91bSMike PritchardNo route to host.
25581fba91bSMike Pritchard.It Bq Er ENOTEMPTY
25681fba91bSMike PritchardDirectory not empty.
25781fba91bSMike Pritchard.It Bq Er EPROCLIM
25881fba91bSMike PritchardToo many processes.
25981fba91bSMike Pritchard.It Bq Er EUSERS
26081fba91bSMike PritchardToo many users.
26181fba91bSMike Pritchard.It Bq Er EDQUOT
26281fba91bSMike PritchardDisc quota exceeded.
26381fba91bSMike Pritchard.It Bq Er ESTALE
26481fba91bSMike PritchardStale NFS file handle.
26581fba91bSMike Pritchard.It Bq Er EREMOTE
26681fba91bSMike PritchardToo many levels of remote in path.
26781fba91bSMike Pritchard.It Bq Er EBADRPC
26881fba91bSMike PritchardRPC struct is bad.
26981fba91bSMike Pritchard.It Bq Er ERPCMISMATCH
27081fba91bSMike PritchardRPC version wrong.
27181fba91bSMike Pritchard.It Bq Er EPROGUNAVAIL
27281fba91bSMike PritchardRPC program not available.
27381fba91bSMike Pritchard.It Bq Er EPROGMISMATCH
27481fba91bSMike PritchardProgram version wrong.
27581fba91bSMike Pritchard.It Bq Er EPROCUNAVAIL
27681fba91bSMike PritchardBad procedure for program.
27781fba91bSMike Pritchard.It Bq Er ENOLCK
27881fba91bSMike PritchardNo locks available.
27981fba91bSMike Pritchard.It Bq Er ENOSYS
28081fba91bSMike PritchardFunction not implemented.
28181fba91bSMike Pritchard.It Bq Er EFTYPE
28281fba91bSMike PritchardInappropriate file type or format.
28381fba91bSMike Pritchard.It Bq Er EAUTH
28481fba91bSMike PritchardAuthentication error.
28581fba91bSMike Pritchard.It Bq Er ENEEDAUTH
28681fba91bSMike PritchardNeed authenticator.
2879a78dbdeSMike Pritchard.El
2889a78dbdeSMike Pritchard.Sh HISTORY
2899a78dbdeSMike PritchardThe
2909a78dbdeSMike Pritchard.Nm
2919a78dbdeSMike Pritchardmanual page example first appeared in
2929cb8091fSMike Pritchard.Fx 2.2 .
29381fba91bSMike Pritchard.Pp
29481fba91bSMike PritchardSome other common
29581fba91bSMike Pritchard.Sx HISTORY
29681fba91bSMike Pritchardsection examples are:
29781fba91bSMike Pritchard.Pp
29881fba91bSMike PritchardThe
29981fba91bSMike Pritchard.Nm
30081fba91bSMike Pritchardmanual page example first appeared in
30181fba91bSMike Pritchard.Bx 4.4 .
30281fba91bSMike Pritchard.Pp
30381fba91bSMike PritchardThe
30481fba91bSMike Pritchard.Nm
30581fba91bSMike Pritchardmanual page example first appeared in
30681fba91bSMike Pritchard.At v6 .
307facbd487SPhilippe Charnier.Sh AUTHORS
3089a78dbdeSMike PritchardThis
309d00f4c32SMike Pritchardmanual page was written by
310facbd487SPhilippe Charnier.An Mike Pritchard Aq mpp@FreeBSD.org .
3119a78dbdeSMike Pritchard.Sh BUGS
3129a78dbdeSMike PritchardThe actual code for this function is vaporware.
313