xref: /freebsd/share/examples/mdoc/example.3 (revision 9cb8091ff082e4af28ad0b3de68298861604f360)
19a78dbdeSMike Pritchard.\" Copyright (c) [year]
24a093a91SJohn-Mark Gurney.\"	[your name].  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.
129d259227SMike Pritchard.\" 3. Neither the name of the author nor the names of any co-contributors
139a78dbdeSMike Pritchard.\"    may be used to endorse or promote products derived from this software
149a78dbdeSMike Pritchard.\"    without specific prior written permission.
159a78dbdeSMike Pritchard.\"
164a093a91SJohn-Mark Gurney.\" THIS SOFTWARE IS PROVIDED BY [your name] AND CONTRIBUTORS ``AS IS'' AND
179a78dbdeSMike Pritchard.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
189a78dbdeSMike Pritchard.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199a78dbdeSMike Pritchard.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
209a78dbdeSMike Pritchard.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
219a78dbdeSMike Pritchard.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
229a78dbdeSMike Pritchard.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239a78dbdeSMike Pritchard.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
249a78dbdeSMike Pritchard.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
259a78dbdeSMike Pritchard.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
269a78dbdeSMike Pritchard.\" SUCH DAMAGE.
279a78dbdeSMike Pritchard.\"
289a78dbdeSMike Pritchard.\"
2981fba91bSMike Pritchard.\" Note: The date here should be updated whenever a non-trivial
3081fba91bSMike Pritchard.\" change is made to the manual page.
3181fba91bSMike Pritchard.Dd January 8, 1997
329a78dbdeSMike Pritchard.Dt EXAMPLE 3
339a78dbdeSMike Pritchard.\" Note: Only specify the operating system when the command
349a78dbdeSMike Pritchard.\" is FreeBSD specific, otherwise use the .Os macro with no
359a78dbdeSMike Pritchard.\" arguments.
369cb8091fSMike Pritchard.Os FreeBSD 2.2
379a78dbdeSMike Pritchard.Sh NAME
389a78dbdeSMike Pritchard.Nm example
399a78dbdeSMike Pritchard.Nd example library function manual page
409a78dbdeSMike Pritchard.Sh SYNOPSIS
419a78dbdeSMike Pritchard.Fd #include <example.h>
429a78dbdeSMike Pritchard.Ft int
439a78dbdeSMike Pritchard.Fn example "char *ptr" "int mode"
449a78dbdeSMike Pritchard.Sh DESCRIPTION
459a78dbdeSMike PritchardThis is an example library function manual page for
469a78dbdeSMike Pritchardthe
479a78dbdeSMike Pritchard.Fn example
489a78dbdeSMike Pritchardfunction.  It is intended
499a78dbdeSMike Pritchardthat this example can be used as a template when writing
509a78dbdeSMike Pritcharda new manual page.
519a78dbdeSMike Pritchard.Pp
529a78dbdeSMike PritchardThe
539a78dbdeSMike Pritchard.Fn example
549a78dbdeSMike Pritchardfunction takes two arguments:
559a78dbdeSMike Pritchard.Fa ptr
569a78dbdeSMike Pritchardand
579a78dbdeSMike Pritchard.Fa mode .
589a78dbdeSMike PritchardThe argument
599a78dbdeSMike Pritchard.Fa mode
609a78dbdeSMike Pritchardmay have one of the following values:
619a78dbdeSMike Pritchard.Bl -tag -width EXAMPLE_ONE
629a78dbdeSMike Pritchard.It Dv EXAMPLE_ONE
639a78dbdeSMike PritchardFirst example of a defined variable.
649a78dbdeSMike Pritchard.Dv EXAMPLE_ONE is described below.
659a78dbdeSMike Pritchard.It Dv EXAMPLE_TWO
669a78dbdeSMike PritchardSecond example.
679a78dbdeSMike Pritchard.El
689a78dbdeSMike Pritchard.Pp
699a78dbdeSMike PritchardThe above value are defined in
70c13b19beSMike Pritchard.Aq Pa example.h
719a78dbdeSMike Pritchardas follows:
729a78dbdeSMike Pritchard.Bd -literal
739a78dbdeSMike Pritchard#define EXAMPLE_ONE  1
749a78dbdeSMike Pritchard#define EXAMPLE_TWO  2
759a78dbdeSMike Pritchard.Ed
769a78dbdeSMike Pritchard.Sh RETURN VALUES
779a78dbdeSMike PritchardA 0 value is returned if the operation succeeds,
789a78dbdeSMike Pritchardotherwise
799a78dbdeSMike Pritchard.Fn example
809a78dbdeSMike Pritchardreturns -1 and the global variable
819a78dbdeSMike Pritchard.Va errno
8281fba91bSMike Pritchardindicates the reason for the failure.
839a78dbdeSMike Pritchard.Sh ENVIRONMENT
849a78dbdeSMike PritchardThe
859a78dbdeSMike Pritchard.Fn example
869a78dbdeSMike Pritchardlibrary function ignores the
879a78dbdeSMike Pritchard.Ev EXAMPLE
889a78dbdeSMike Pritchardenvironment variable.
899a78dbdeSMike Pritchard.Sh FILES
909a78dbdeSMike Pritchard.Bl -tag -width /dev/null -compact
919a78dbdeSMike Pritchard.It Pa /dev/null
929a78dbdeSMike PritchardExample of a file in the
939a78dbdeSMike Pritchard.Sx FILES
949a78dbdeSMike Pritchardsection.
959a78dbdeSMike Pritchard.El
969a78dbdeSMike Pritchard.Sh SEE ALSO
979a78dbdeSMike Pritchard.Xr example 1 ,
989a78dbdeSMike Pritchard.Xr example 4 ,
999a78dbdeSMike Pritchard.Xr mdoc 7 ,
1009a78dbdeSMike Pritchard.Xr mdoc.samples 7
10181fba91bSMike Pritchard.Rs
10281fba91bSMike Pritchard.%A A. B. Author
10381fba91bSMike Pritchard.%T Example RFC Title
10481fba91bSMike Pritchard.%O RFC0000
10581fba91bSMike Pritchard.Re
10681fba91bSMike Pritchard.Rs
10781fba91bSMike Pritchard.%A A. B. Author
10881fba91bSMike Pritchard.%B Example Book Title
10981fba91bSMike Pritchard.%O ISBN-0-000-00000-0
11081fba91bSMike Pritchard.Re
11181fba91bSMike Pritchard.Rs
11281fba91bSMike Pritchard.%A A. B. Author
11381fba91bSMike Pritchard.%D January 1997
11481fba91bSMike Pritchard.%J Example Journal Name
11581fba91bSMike Pritchard.%T Example Article Title
11681fba91bSMike Pritchard.Re
1179a78dbdeSMike Pritchard.Sh STANDARDS
1189a78dbdeSMike PritchardIf the command conforms to some standard, such as
1199a78dbdeSMike Pritchard.St -p1003.2
1209a78dbdeSMike Pritchardor
1219a78dbdeSMike Pritchard.St -ansiC ,
1229a78dbdeSMike Pritchardit should be noted here.
1239a78dbdeSMike Pritchard.Sh DIAGNOSTICS
1249a78dbdeSMike PritchardNone.
1259a78dbdeSMike Pritchard.Sh ERRORS
12681fba91bSMike Pritchard.\" Delete any errno's that are not returned by your
12781fba91bSMike Pritchard.\" function or system call and then tailor the
12881fba91bSMike Pritchard.\" remaining text as needed.
1299a78dbdeSMike Pritchard.Fn Example
1309a78dbdeSMike Pritchardwill fail if:
1319a78dbdeSMike Pritchard.Bl -tag -width Er
1329a78dbdeSMike Pritchard.It Bq Er EPERM
13381fba91bSMike PritchardOperation not permitted.
13481fba91bSMike Pritchard.It Bq Er ENOENT
13581fba91bSMike PritchardNo such file or directory.
13681fba91bSMike Pritchard.It Bq Er ESRCH
13781fba91bSMike PritchardNo such process.
13881fba91bSMike Pritchard.It Bq Er EINTR
13981fba91bSMike PritchardInterrupted system call.
14081fba91bSMike Pritchard.It Bq Er EIO
14181fba91bSMike PritchardInput/output error.
14281fba91bSMike Pritchard.It Bq Er ENXIO
14381fba91bSMike PritchardDevice not configured.
14481fba91bSMike Pritchard.It Bq Er E2BIG
14581fba91bSMike PritchardArgument list too long.
14681fba91bSMike Pritchard.It Bq Er ENOEXEC
14781fba91bSMike PritchardExec format error.
14881fba91bSMike Pritchard.It Bq Er EBADF
14981fba91bSMike PritchardBad file descriptor.
15081fba91bSMike Pritchard.It Bq Er ECHILD
15181fba91bSMike PritchardNo child processes.
15281fba91bSMike Pritchard.It Bq Er EDEADLK
15381fba91bSMike PritchardResource deadlock avoided.
15481fba91bSMike Pritchard.It Bq Er ENOMEM
15581fba91bSMike PritchardCannot allocate memory.
15681fba91bSMike Pritchard.It Bq Er EACCES
15781fba91bSMike PritchardPermission denied.
15881fba91bSMike Pritchard.It Bq Er EFAULT
15981fba91bSMike PritchardBad address.
16081fba91bSMike Pritchard.It Bq Er ENOTBLK
16181fba91bSMike PritchardBlock device required.
16281fba91bSMike Pritchard.It Bq Er EBUSY
16381fba91bSMike PritchardDevice busy.
16481fba91bSMike Pritchard.It Bq Er EEXIST
16581fba91bSMike PritchardFile exists.
16681fba91bSMike Pritchard.It Bq Er EXDEV
16781fba91bSMike PritchardCross-device link.
16881fba91bSMike Pritchard.It Bq Er ENODEV
16981fba91bSMike PritchardOperation not supported by device.
17081fba91bSMike Pritchard.It Bq Er ENOTDIR
17181fba91bSMike PritchardNot a directory.
17281fba91bSMike Pritchard.It Bq Er EISDIR
17381fba91bSMike PritchardIs a directory.
17481fba91bSMike Pritchard.It Bq Er EINVAL
17581fba91bSMike PritchardInvalid argument.
17681fba91bSMike Pritchard.It Bq Er ENFILE
17781fba91bSMike PritchardToo many open files in system.
17881fba91bSMike Pritchard.It Bq Er EMFILE
17981fba91bSMike PritchardToo many open files.
18081fba91bSMike Pritchard.It Bq Er ENOTTY
18181fba91bSMike PritchardInappropriate ioctl for device.
18281fba91bSMike Pritchard.It Bq Er ETXTBSY
18381fba91bSMike PritchardText file busy.
18481fba91bSMike Pritchard.It Bq Er EFBIG
18581fba91bSMike PritchardFile too large.
18681fba91bSMike Pritchard.It Bq Er ENOSPC
18781fba91bSMike PritchardNo space left on device.
18881fba91bSMike Pritchard.It Bq Er ESPIPE
18981fba91bSMike PritchardIllegal seek.
19081fba91bSMike Pritchard.It Bq Er EROFS
19181fba91bSMike PritchardRead-only file system.
19281fba91bSMike Pritchard.It Bq Er EMLINK
19381fba91bSMike PritchardToo many links.
19481fba91bSMike Pritchard.It Bq Er EPIPE
19581fba91bSMike PritchardBroken pipe.
19681fba91bSMike Pritchard.It Bq Er EDOM
19781fba91bSMike PritchardNumerical argument out of domain.
19881fba91bSMike Pritchard.It Bq Er ERANGE
19981fba91bSMike PritchardResult too large.
20081fba91bSMike Pritchard.It Bq Er EAGAIN
20181fba91bSMike PritchardResource temporarily unavailable.
20281fba91bSMike Pritchard.It Bq Er EWOULDBLOCK
20381fba91bSMike PritchardOperation would block.
20481fba91bSMike Pritchard.It Bq Er EINPROGRESS
20581fba91bSMike PritchardOperation now in progress.
20681fba91bSMike Pritchard.It Bq Er EALREADY
20781fba91bSMike PritchardOperation already in progress.
20881fba91bSMike Pritchard.It Bq Er ENOTSOCK
20981fba91bSMike PritchardSocket operation on non-socket.
21081fba91bSMike Pritchard.It Bq Er EDESTADDRREQ
21181fba91bSMike PritchardDestination address required.
21281fba91bSMike Pritchard.It Bq Er EMSGSIZE
21381fba91bSMike PritchardMessage too long.
21481fba91bSMike Pritchard.It Bq Er EPROTOTYPE
21581fba91bSMike PritchardProtocol wrong type for socket.
21681fba91bSMike Pritchard.It Bq Er ENOPROTOOPT
21781fba91bSMike PritchardProtocol not available.
21881fba91bSMike Pritchard.It Bq Er EPROTONOSUPPORT
21981fba91bSMike PritchardProtocol not supported.
22081fba91bSMike Pritchard.It Bq Er ESOCKNOTSUPORT
22181fba91bSMike PritchardSocket type not supported.
22281fba91bSMike Pritchard.It Bq Er EOPNOTSUPP
22381fba91bSMike PritchardOperation not supported.
22481fba91bSMike Pritchard.It Bq Er EPFNOSUPPORT
22581fba91bSMike PritchardProtocol family not supported.
22681fba91bSMike Pritchard.It Bq Er EAFNNOSUPPORT
22781fba91bSMike PritchardAddress family not supported by protocol family.
22881fba91bSMike Pritchard.It Bq Er EADDRINUSE
22981fba91bSMike PritchardAddress already in use.
23081fba91bSMike Pritchard.It Bq Er EADDRNOTAVAIL
23181fba91bSMike PritchardCannot assign requested address.
23281fba91bSMike Pritchard.It Bq Er ENETDOWN
23381fba91bSMike PritchardNetwork is down.
23481fba91bSMike Pritchard.It Bq Er ENETUNREACH
23581fba91bSMike PritchardNetwork is unreachable.
23681fba91bSMike Pritchard.It Bq Er ENETRESET
23781fba91bSMike PritchardNetwork dropped connection on reset.
23881fba91bSMike Pritchard.It Bq Er ECONNABORTED
23981fba91bSMike PritchardSoftware causes connection abort.
24081fba91bSMike Pritchard.It Bq Er ENOBUFS
24181fba91bSMike PritchardNo buffer space available.
24281fba91bSMike Pritchard.It Bq Er EISCONN
24381fba91bSMike PritchardSocket is already connected.
24481fba91bSMike Pritchard.It Bq Er ENOTCONN
24581fba91bSMike PritchardSocket is not connected.
24681fba91bSMike Pritchard.It Bq Er ESHUTDOWN
24781fba91bSMike PritchardCannot send after socket shutdown.
24881fba91bSMike Pritchard.It Bq Er ETOOMANYREFS
24981fba91bSMike PritchardToo many references:  cannot splice.
25081fba91bSMike Pritchard.It Bq Er ETIMEDOUT
25181fba91bSMike PritchardOperation timed out.
25281fba91bSMike Pritchard.It Bq Er ECONNREFUSED
25381fba91bSMike PritchardConnection refused.
25481fba91bSMike Pritchard.It Bq Er ELOOP
25581fba91bSMike PritchardToo many levels of symbolic links.
25681fba91bSMike Pritchard.It Bq Er ENAMETOOLONG
25781fba91bSMike PritchardFile name too long.
25881fba91bSMike Pritchard.It Bq Er EHOSTDOWN
25981fba91bSMike PritchardHost is down.
26081fba91bSMike Pritchard.It Bq Er EHOSTUNREACH
26181fba91bSMike PritchardNo route to host.
26281fba91bSMike Pritchard.It Bq Er ENOTEMPTY
26381fba91bSMike PritchardDirectory not empty.
26481fba91bSMike Pritchard.It Bq Er EPROCLIM
26581fba91bSMike PritchardToo many processes.
26681fba91bSMike Pritchard.It Bq Er EUSERS
26781fba91bSMike PritchardToo many users.
26881fba91bSMike Pritchard.It Bq Er EDQUOT
26981fba91bSMike PritchardDisc quota exceeded.
27081fba91bSMike Pritchard.It Bq Er ESTALE
27181fba91bSMike PritchardStale NFS file handle.
27281fba91bSMike Pritchard.It Bq Er EREMOTE
27381fba91bSMike PritchardToo many levels of remote in path.
27481fba91bSMike Pritchard.It Bq Er EBADRPC
27581fba91bSMike PritchardRPC struct is bad.
27681fba91bSMike Pritchard.It Bq Er ERPCMISMATCH
27781fba91bSMike PritchardRPC version wrong.
27881fba91bSMike Pritchard.It Bq Er EPROGUNAVAIL
27981fba91bSMike PritchardRPC program not available.
28081fba91bSMike Pritchard.It Bq Er EPROGMISMATCH
28181fba91bSMike PritchardProgram version wrong.
28281fba91bSMike Pritchard.It Bq Er EPROCUNAVAIL
28381fba91bSMike PritchardBad procedure for program.
28481fba91bSMike Pritchard.It Bq Er ENOLCK
28581fba91bSMike PritchardNo locks available.
28681fba91bSMike Pritchard.It Bq Er ENOSYS
28781fba91bSMike PritchardFunction not implemented.
28881fba91bSMike Pritchard.It Bq Er EFTYPE
28981fba91bSMike PritchardInappropriate file type or format.
29081fba91bSMike Pritchard.It Bq Er EAUTH
29181fba91bSMike PritchardAuthentication error.
29281fba91bSMike Pritchard.It Bq Er ENEEDAUTH
29381fba91bSMike PritchardNeed authenticator.
2949a78dbdeSMike Pritchard.El
2959a78dbdeSMike Pritchard.Sh HISTORY
2969a78dbdeSMike PritchardThe
2979a78dbdeSMike Pritchard.Nm
2989a78dbdeSMike Pritchardmanual page example first appeared in
2999cb8091fSMike Pritchard.Fx 2.2 .
30081fba91bSMike Pritchard.Pp
30181fba91bSMike PritchardSome other common
30281fba91bSMike Pritchard.Sx HISTORY
30381fba91bSMike Pritchardsection examples are:
30481fba91bSMike Pritchard.Pp
30581fba91bSMike PritchardThe
30681fba91bSMike Pritchard.Nm
30781fba91bSMike Pritchardmanual page example first appeared in
30881fba91bSMike Pritchard.Bx 4.4 .
30981fba91bSMike Pritchard.Pp
31081fba91bSMike PritchardThe
31181fba91bSMike Pritchard.Nm
31281fba91bSMike Pritchardmanual page example first appeared in
31381fba91bSMike Pritchard.At v6 .
3149a78dbdeSMike Pritchard.Sh AUTHOR
3159a78dbdeSMike PritchardThis
3169a78dbdeSMike Pritchardmanual page was written by Mike Pritchard
3179a78dbdeSMike Pritchard.Aq mpp@FreeBSD.ORG .
3189a78dbdeSMike Pritchard.Sh BUGS
3199a78dbdeSMike PritchardThe actual code for this function is vaporware.
320