xref: /freebsd/share/examples/mdoc/example.3 (revision 0d2332f2d1726d484b4aaf8b6e9ffb1b22d4a651)
1.\" Copyright (c) [year] [your name]
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\" Note: All FreeBSD man pages should have a FreeBSD revision
27.\" control id to make it easier for translation teams to track
28.\" changes.
29.\"
30.\" Note: The date here should be updated whenever a non-trivial
31.\" change is made to the manual page.
32.Dd December 8, 1999
33.Dt EXAMPLE 3
34.\" Note: Only specify the operating system when the command
35.\" is FreeBSD specific, otherwise use the .Os macro with no
36.\" arguments.
37.Os FreeBSD 2.2
38.Sh NAME
39.Nm example
40.Nd example library function manual page
41.Sh LIBRARY
42.\" Note: list of available libraries is available in mdoc.samples(7)
43.Lb libc
44.Sh SYNOPSIS
45.Fd #include <example.h>
46.Ft int
47.Fn example "char *ptr" "int mode"
48.Sh DESCRIPTION
49This is an example library function manual page for
50the
51.Fn example
52function.  It is intended
53that this example can be used as a template when writing
54a new manual page.
55.Pp
56The
57.Fn example
58function takes two arguments:
59.Fa ptr
60and
61.Fa mode .
62The argument
63.Fa mode
64may have one of the following values:
65.Bl -tag -width EXAMPLE_ONE
66.It Dv EXAMPLE_ONE
67First example of a defined variable.
68.Dv EXAMPLE_ONE is described below.
69.It Dv EXAMPLE_TWO
70Second example.
71.El
72.Pp
73The above value are defined in
74.Aq Pa example.h
75as follows:
76.Bd -literal
77#define EXAMPLE_ONE  1
78#define EXAMPLE_TWO  2
79.Ed
80.Sh IMPLEMENTATION NOTES
81The
82.Fn example
83function is not actually implemented.
84.Sh RETURN VALUES
85.Rv -std example
86.Sh ENVIRONMENT
87The
88.Fn example
89library function ignores the
90.Ev EXAMPLE
91environment variable.
92.Sh FILES
93.Bl -tag -width /dev/null -compact
94.It Pa /dev/null
95Example of a file in the
96.Sx FILES
97section.
98.El
99.Sh DIAGNOSTICS
100None.
101.Sh COMPATIBILITY
102The
103.Fn example
104function has no known compatibility issues.
105.Sh ERRORS
106.\" Delete any errno's that are not returned by your
107.\" function or system call and then tailor the
108.\" remaining text as needed.
109.Fn Example
110will fail if:
111.Bl -tag -width Er
112.It Bq Er EPERM
113Operation not permitted.
114.It Bq Er ENOENT
115No such file or directory.
116.It Bq Er ESRCH
117No such process.
118.It Bq Er EINTR
119Interrupted system call.
120.It Bq Er EIO
121Input/output error.
122.It Bq Er ENXIO
123Device not configured.
124.It Bq Er E2BIG
125Argument list too long.
126.It Bq Er ENOEXEC
127Exec format error.
128.It Bq Er EBADF
129Bad file descriptor.
130.It Bq Er ECHILD
131No child processes.
132.It Bq Er EDEADLK
133Resource deadlock avoided.
134.It Bq Er ENOMEM
135Cannot allocate memory.
136.It Bq Er EACCES
137Permission denied.
138.It Bq Er EFAULT
139Bad address.
140.It Bq Er ENOTBLK
141Block device required.
142.It Bq Er EBUSY
143Device busy.
144.It Bq Er EEXIST
145File exists.
146.It Bq Er EXDEV
147Cross-device link.
148.It Bq Er ENODEV
149Operation not supported by device.
150.It Bq Er ENOTDIR
151Not a directory.
152.It Bq Er EISDIR
153Is a directory.
154.It Bq Er EINVAL
155Invalid argument.
156.It Bq Er ENFILE
157Too many open files in system.
158.It Bq Er EMFILE
159Too many open files.
160.It Bq Er ENOTTY
161Inappropriate ioctl for device.
162.It Bq Er ETXTBSY
163Text file busy.
164.It Bq Er EFBIG
165File too large.
166.It Bq Er ENOSPC
167No space left on device.
168.It Bq Er ESPIPE
169Illegal seek.
170.It Bq Er EROFS
171Read-only file system.
172.It Bq Er EMLINK
173Too many links.
174.It Bq Er EPIPE
175Broken pipe.
176.It Bq Er EDOM
177Numerical argument out of domain.
178.It Bq Er ERANGE
179Result too large.
180.It Bq Er EAGAIN
181Resource temporarily unavailable.
182.It Bq Er EWOULDBLOCK
183Operation would block.
184.It Bq Er EINPROGRESS
185Operation now in progress.
186.It Bq Er EALREADY
187Operation already in progress.
188.It Bq Er ENOTSOCK
189Socket operation on non-socket.
190.It Bq Er EDESTADDRREQ
191Destination address required.
192.It Bq Er EMSGSIZE
193Message too long.
194.It Bq Er EPROTOTYPE
195Protocol wrong type for socket.
196.It Bq Er ENOPROTOOPT
197Protocol not available.
198.It Bq Er EPROTONOSUPPORT
199Protocol not supported.
200.It Bq Er ESOCKNOTSUPORT
201Socket type not supported.
202.It Bq Er EOPNOTSUPP
203Operation not supported.
204.It Bq Er EPFNOSUPPORT
205Protocol family not supported.
206.It Bq Er EAFNNOSUPPORT
207Address family not supported by protocol family.
208.It Bq Er EADDRINUSE
209Address already in use.
210.It Bq Er EADDRNOTAVAIL
211Cannot assign requested address.
212.It Bq Er ENETDOWN
213Network is down.
214.It Bq Er ENETUNREACH
215Network is unreachable.
216.It Bq Er ENETRESET
217Network dropped connection on reset.
218.It Bq Er ECONNABORTED
219Software causes connection abort.
220.It Bq Er ENOBUFS
221No buffer space available.
222.It Bq Er EISCONN
223Socket is already connected.
224.It Bq Er ENOTCONN
225Socket is not connected.
226.It Bq Er ESHUTDOWN
227Cannot send after socket shutdown.
228.It Bq Er ETOOMANYREFS
229Too many references:  cannot splice.
230.It Bq Er ETIMEDOUT
231Operation timed out.
232.It Bq Er ECONNREFUSED
233Connection refused.
234.It Bq Er ELOOP
235Too many levels of symbolic links.
236.It Bq Er ENAMETOOLONG
237File name too long.
238.It Bq Er EHOSTDOWN
239Host is down.
240.It Bq Er EHOSTUNREACH
241No route to host.
242.It Bq Er ENOTEMPTY
243Directory not empty.
244.It Bq Er EPROCLIM
245Too many processes.
246.It Bq Er EUSERS
247Too many users.
248.It Bq Er EDQUOT
249Disc quota exceeded.
250.It Bq Er ESTALE
251Stale NFS file handle.
252.It Bq Er EREMOTE
253Too many levels of remote in path.
254.It Bq Er EBADRPC
255RPC struct is bad.
256.It Bq Er ERPCMISMATCH
257RPC version wrong.
258.It Bq Er EPROGUNAVAIL
259RPC program not available.
260.It Bq Er EPROGMISMATCH
261Program version wrong.
262.It Bq Er EPROCUNAVAIL
263Bad procedure for program.
264.It Bq Er ENOLCK
265No locks available.
266.It Bq Er ENOSYS
267Function not implemented.
268.It Bq Er EFTYPE
269Inappropriate file type or format.
270.It Bq Er EAUTH
271Authentication error.
272.It Bq Er ENEEDAUTH
273Need authenticator.
274.El
275.Sh SEE ALSO
276.Xr example 1 ,
277.Xr example 4 ,
278.Xr mdoc 7 ,
279.Xr mdoc.samples 7
280.Rs
281.%A A. B. Author
282.%T Example RFC Title
283.%O RFC0000
284.Re
285.Rs
286.%A A. B. Author
287.%B Example Book Title
288.%O ISBN-0-000-00000-0
289.Re
290.Rs
291.%A A. B. Author
292.%D January 1997
293.%J Example Journal Name
294.%T Example Article Title
295.Re
296.Sh STANDARDS
297If the command conforms to some standard, such as
298.St -p1003.2
299or
300.St -ansiC ,
301it should be noted here.
302.Sh HISTORY
303The
304.Nm
305manual page example first appeared in
306.Fx 2.2 .
307.Pp
308Some other common
309.Sx HISTORY
310section examples are:
311.Pp
312The
313.Nm
314manual page example first appeared in
315.Bx 4.4 .
316.Pp
317The
318.Nm
319manual page example first appeared in
320.At v6 .
321.Sh AUTHORS
322This
323manual page was written by
324.An Mike Pritchard Aq mpp@FreeBSD.org .
325.Sh BUGS
326The actual code for this function is vaporware.
327