xref: /freebsd/share/examples/mdoc/example.3 (revision 374334e4118ca8bd3afc98656f8d389a289e6fee)
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
759a78dbdeSMike PritchardA 0 value is returned if the operation succeeds,
769a78dbdeSMike Pritchardotherwise
779a78dbdeSMike Pritchard.Fn example
789a78dbdeSMike Pritchardreturns -1 and the global variable
799a78dbdeSMike Pritchard.Va errno
8081fba91bSMike Pritchardindicates the reason for the failure.
819a78dbdeSMike Pritchard.Sh ENVIRONMENT
829a78dbdeSMike PritchardThe
839a78dbdeSMike Pritchard.Fn example
849a78dbdeSMike Pritchardlibrary function ignores the
859a78dbdeSMike Pritchard.Ev EXAMPLE
869a78dbdeSMike Pritchardenvironment variable.
879a78dbdeSMike Pritchard.Sh FILES
889a78dbdeSMike Pritchard.Bl -tag -width /dev/null -compact
899a78dbdeSMike Pritchard.It Pa /dev/null
909a78dbdeSMike PritchardExample of a file in the
919a78dbdeSMike Pritchard.Sx FILES
929a78dbdeSMike Pritchardsection.
939a78dbdeSMike Pritchard.El
949a78dbdeSMike Pritchard.Sh SEE ALSO
959a78dbdeSMike Pritchard.Xr example 1 ,
969a78dbdeSMike Pritchard.Xr example 4 ,
979a78dbdeSMike Pritchard.Xr mdoc 7 ,
989a78dbdeSMike Pritchard.Xr mdoc.samples 7
9981fba91bSMike Pritchard.Rs
10081fba91bSMike Pritchard.%A A. B. Author
10181fba91bSMike Pritchard.%T Example RFC Title
10281fba91bSMike Pritchard.%O RFC0000
10381fba91bSMike Pritchard.Re
10481fba91bSMike Pritchard.Rs
10581fba91bSMike Pritchard.%A A. B. Author
10681fba91bSMike Pritchard.%B Example Book Title
10781fba91bSMike Pritchard.%O ISBN-0-000-00000-0
10881fba91bSMike Pritchard.Re
10981fba91bSMike Pritchard.Rs
11081fba91bSMike Pritchard.%A A. B. Author
11181fba91bSMike Pritchard.%D January 1997
11281fba91bSMike Pritchard.%J Example Journal Name
11381fba91bSMike Pritchard.%T Example Article Title
11481fba91bSMike Pritchard.Re
1159a78dbdeSMike Pritchard.Sh STANDARDS
1169a78dbdeSMike PritchardIf the command conforms to some standard, such as
1179a78dbdeSMike Pritchard.St -p1003.2
1189a78dbdeSMike Pritchardor
1199a78dbdeSMike Pritchard.St -ansiC ,
1209a78dbdeSMike Pritchardit should be noted here.
1219a78dbdeSMike Pritchard.Sh DIAGNOSTICS
1229a78dbdeSMike PritchardNone.
1239a78dbdeSMike Pritchard.Sh ERRORS
12481fba91bSMike Pritchard.\" Delete any errno's that are not returned by your
12581fba91bSMike Pritchard.\" function or system call and then tailor the
12681fba91bSMike Pritchard.\" remaining text as needed.
1279a78dbdeSMike Pritchard.Fn Example
1289a78dbdeSMike Pritchardwill fail if:
1299a78dbdeSMike Pritchard.Bl -tag -width Er
1309a78dbdeSMike Pritchard.It Bq Er EPERM
13181fba91bSMike PritchardOperation not permitted.
13281fba91bSMike Pritchard.It Bq Er ENOENT
13381fba91bSMike PritchardNo such file or directory.
13481fba91bSMike Pritchard.It Bq Er ESRCH
13581fba91bSMike PritchardNo such process.
13681fba91bSMike Pritchard.It Bq Er EINTR
13781fba91bSMike PritchardInterrupted system call.
13881fba91bSMike Pritchard.It Bq Er EIO
13981fba91bSMike PritchardInput/output error.
14081fba91bSMike Pritchard.It Bq Er ENXIO
14181fba91bSMike PritchardDevice not configured.
14281fba91bSMike Pritchard.It Bq Er E2BIG
14381fba91bSMike PritchardArgument list too long.
14481fba91bSMike Pritchard.It Bq Er ENOEXEC
14581fba91bSMike PritchardExec format error.
14681fba91bSMike Pritchard.It Bq Er EBADF
14781fba91bSMike PritchardBad file descriptor.
14881fba91bSMike Pritchard.It Bq Er ECHILD
14981fba91bSMike PritchardNo child processes.
15081fba91bSMike Pritchard.It Bq Er EDEADLK
15181fba91bSMike PritchardResource deadlock avoided.
15281fba91bSMike Pritchard.It Bq Er ENOMEM
15381fba91bSMike PritchardCannot allocate memory.
15481fba91bSMike Pritchard.It Bq Er EACCES
15581fba91bSMike PritchardPermission denied.
15681fba91bSMike Pritchard.It Bq Er EFAULT
15781fba91bSMike PritchardBad address.
15881fba91bSMike Pritchard.It Bq Er ENOTBLK
15981fba91bSMike PritchardBlock device required.
16081fba91bSMike Pritchard.It Bq Er EBUSY
16181fba91bSMike PritchardDevice busy.
16281fba91bSMike Pritchard.It Bq Er EEXIST
16381fba91bSMike PritchardFile exists.
16481fba91bSMike Pritchard.It Bq Er EXDEV
16581fba91bSMike PritchardCross-device link.
16681fba91bSMike Pritchard.It Bq Er ENODEV
16781fba91bSMike PritchardOperation not supported by device.
16881fba91bSMike Pritchard.It Bq Er ENOTDIR
16981fba91bSMike PritchardNot a directory.
17081fba91bSMike Pritchard.It Bq Er EISDIR
17181fba91bSMike PritchardIs a directory.
17281fba91bSMike Pritchard.It Bq Er EINVAL
17381fba91bSMike PritchardInvalid argument.
17481fba91bSMike Pritchard.It Bq Er ENFILE
17581fba91bSMike PritchardToo many open files in system.
17681fba91bSMike Pritchard.It Bq Er EMFILE
17781fba91bSMike PritchardToo many open files.
17881fba91bSMike Pritchard.It Bq Er ENOTTY
17981fba91bSMike PritchardInappropriate ioctl for device.
18081fba91bSMike Pritchard.It Bq Er ETXTBSY
18181fba91bSMike PritchardText file busy.
18281fba91bSMike Pritchard.It Bq Er EFBIG
18381fba91bSMike PritchardFile too large.
18481fba91bSMike Pritchard.It Bq Er ENOSPC
18581fba91bSMike PritchardNo space left on device.
18681fba91bSMike Pritchard.It Bq Er ESPIPE
18781fba91bSMike PritchardIllegal seek.
18881fba91bSMike Pritchard.It Bq Er EROFS
18981fba91bSMike PritchardRead-only file system.
19081fba91bSMike Pritchard.It Bq Er EMLINK
19181fba91bSMike PritchardToo many links.
19281fba91bSMike Pritchard.It Bq Er EPIPE
19381fba91bSMike PritchardBroken pipe.
19481fba91bSMike Pritchard.It Bq Er EDOM
19581fba91bSMike PritchardNumerical argument out of domain.
19681fba91bSMike Pritchard.It Bq Er ERANGE
19781fba91bSMike PritchardResult too large.
19881fba91bSMike Pritchard.It Bq Er EAGAIN
19981fba91bSMike PritchardResource temporarily unavailable.
20081fba91bSMike Pritchard.It Bq Er EWOULDBLOCK
20181fba91bSMike PritchardOperation would block.
20281fba91bSMike Pritchard.It Bq Er EINPROGRESS
20381fba91bSMike PritchardOperation now in progress.
20481fba91bSMike Pritchard.It Bq Er EALREADY
20581fba91bSMike PritchardOperation already in progress.
20681fba91bSMike Pritchard.It Bq Er ENOTSOCK
20781fba91bSMike PritchardSocket operation on non-socket.
20881fba91bSMike Pritchard.It Bq Er EDESTADDRREQ
20981fba91bSMike PritchardDestination address required.
21081fba91bSMike Pritchard.It Bq Er EMSGSIZE
21181fba91bSMike PritchardMessage too long.
21281fba91bSMike Pritchard.It Bq Er EPROTOTYPE
21381fba91bSMike PritchardProtocol wrong type for socket.
21481fba91bSMike Pritchard.It Bq Er ENOPROTOOPT
21581fba91bSMike PritchardProtocol not available.
21681fba91bSMike Pritchard.It Bq Er EPROTONOSUPPORT
21781fba91bSMike PritchardProtocol not supported.
21881fba91bSMike Pritchard.It Bq Er ESOCKNOTSUPORT
21981fba91bSMike PritchardSocket type not supported.
22081fba91bSMike Pritchard.It Bq Er EOPNOTSUPP
22181fba91bSMike PritchardOperation not supported.
22281fba91bSMike Pritchard.It Bq Er EPFNOSUPPORT
22381fba91bSMike PritchardProtocol family not supported.
22481fba91bSMike Pritchard.It Bq Er EAFNNOSUPPORT
22581fba91bSMike PritchardAddress family not supported by protocol family.
22681fba91bSMike Pritchard.It Bq Er EADDRINUSE
22781fba91bSMike PritchardAddress already in use.
22881fba91bSMike Pritchard.It Bq Er EADDRNOTAVAIL
22981fba91bSMike PritchardCannot assign requested address.
23081fba91bSMike Pritchard.It Bq Er ENETDOWN
23181fba91bSMike PritchardNetwork is down.
23281fba91bSMike Pritchard.It Bq Er ENETUNREACH
23381fba91bSMike PritchardNetwork is unreachable.
23481fba91bSMike Pritchard.It Bq Er ENETRESET
23581fba91bSMike PritchardNetwork dropped connection on reset.
23681fba91bSMike Pritchard.It Bq Er ECONNABORTED
23781fba91bSMike PritchardSoftware causes connection abort.
23881fba91bSMike Pritchard.It Bq Er ENOBUFS
23981fba91bSMike PritchardNo buffer space available.
24081fba91bSMike Pritchard.It Bq Er EISCONN
24181fba91bSMike PritchardSocket is already connected.
24281fba91bSMike Pritchard.It Bq Er ENOTCONN
24381fba91bSMike PritchardSocket is not connected.
24481fba91bSMike Pritchard.It Bq Er ESHUTDOWN
24581fba91bSMike PritchardCannot send after socket shutdown.
24681fba91bSMike Pritchard.It Bq Er ETOOMANYREFS
24781fba91bSMike PritchardToo many references:  cannot splice.
24881fba91bSMike Pritchard.It Bq Er ETIMEDOUT
24981fba91bSMike PritchardOperation timed out.
25081fba91bSMike Pritchard.It Bq Er ECONNREFUSED
25181fba91bSMike PritchardConnection refused.
25281fba91bSMike Pritchard.It Bq Er ELOOP
25381fba91bSMike PritchardToo many levels of symbolic links.
25481fba91bSMike Pritchard.It Bq Er ENAMETOOLONG
25581fba91bSMike PritchardFile name too long.
25681fba91bSMike Pritchard.It Bq Er EHOSTDOWN
25781fba91bSMike PritchardHost is down.
25881fba91bSMike Pritchard.It Bq Er EHOSTUNREACH
25981fba91bSMike PritchardNo route to host.
26081fba91bSMike Pritchard.It Bq Er ENOTEMPTY
26181fba91bSMike PritchardDirectory not empty.
26281fba91bSMike Pritchard.It Bq Er EPROCLIM
26381fba91bSMike PritchardToo many processes.
26481fba91bSMike Pritchard.It Bq Er EUSERS
26581fba91bSMike PritchardToo many users.
26681fba91bSMike Pritchard.It Bq Er EDQUOT
26781fba91bSMike PritchardDisc quota exceeded.
26881fba91bSMike Pritchard.It Bq Er ESTALE
26981fba91bSMike PritchardStale NFS file handle.
27081fba91bSMike Pritchard.It Bq Er EREMOTE
27181fba91bSMike PritchardToo many levels of remote in path.
27281fba91bSMike Pritchard.It Bq Er EBADRPC
27381fba91bSMike PritchardRPC struct is bad.
27481fba91bSMike Pritchard.It Bq Er ERPCMISMATCH
27581fba91bSMike PritchardRPC version wrong.
27681fba91bSMike Pritchard.It Bq Er EPROGUNAVAIL
27781fba91bSMike PritchardRPC program not available.
27881fba91bSMike Pritchard.It Bq Er EPROGMISMATCH
27981fba91bSMike PritchardProgram version wrong.
28081fba91bSMike Pritchard.It Bq Er EPROCUNAVAIL
28181fba91bSMike PritchardBad procedure for program.
28281fba91bSMike Pritchard.It Bq Er ENOLCK
28381fba91bSMike PritchardNo locks available.
28481fba91bSMike Pritchard.It Bq Er ENOSYS
28581fba91bSMike PritchardFunction not implemented.
28681fba91bSMike Pritchard.It Bq Er EFTYPE
28781fba91bSMike PritchardInappropriate file type or format.
28881fba91bSMike Pritchard.It Bq Er EAUTH
28981fba91bSMike PritchardAuthentication error.
29081fba91bSMike Pritchard.It Bq Er ENEEDAUTH
29181fba91bSMike PritchardNeed authenticator.
2929a78dbdeSMike Pritchard.El
2939a78dbdeSMike Pritchard.Sh HISTORY
2949a78dbdeSMike PritchardThe
2959a78dbdeSMike Pritchard.Nm
2969a78dbdeSMike Pritchardmanual page example first appeared in
2979cb8091fSMike Pritchard.Fx 2.2 .
29881fba91bSMike Pritchard.Pp
29981fba91bSMike PritchardSome other common
30081fba91bSMike Pritchard.Sx HISTORY
30181fba91bSMike Pritchardsection examples are:
30281fba91bSMike Pritchard.Pp
30381fba91bSMike PritchardThe
30481fba91bSMike Pritchard.Nm
30581fba91bSMike Pritchardmanual page example first appeared in
30681fba91bSMike Pritchard.Bx 4.4 .
30781fba91bSMike Pritchard.Pp
30881fba91bSMike PritchardThe
30981fba91bSMike Pritchard.Nm
31081fba91bSMike Pritchardmanual page example first appeared in
31181fba91bSMike Pritchard.At v6 .
3129a78dbdeSMike Pritchard.Sh AUTHOR
3139a78dbdeSMike PritchardThis
3149a78dbdeSMike Pritchardmanual page was written by Mike Pritchard
3159a78dbdeSMike Pritchard.Aq mpp@FreeBSD.ORG .
3169a78dbdeSMike Pritchard.Sh BUGS
3179a78dbdeSMike PritchardThe actual code for this function is vaporware.
318