xref: /freebsd/share/examples/mdoc/example.3 (revision 4cf49a43559ed9fdad601bdcccd2c55963008675)
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 January 8, 1997
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 SYNOPSIS
42.Fd #include <example.h>
43.Ft int
44.Fn example "char *ptr" "int mode"
45.Sh DESCRIPTION
46This is an example library function manual page for
47the
48.Fn example
49function.  It is intended
50that this example can be used as a template when writing
51a new manual page.
52.Pp
53The
54.Fn example
55function takes two arguments:
56.Fa ptr
57and
58.Fa mode .
59The argument
60.Fa mode
61may have one of the following values:
62.Bl -tag -width EXAMPLE_ONE
63.It Dv EXAMPLE_ONE
64First example of a defined variable.
65.Dv EXAMPLE_ONE is described below.
66.It Dv EXAMPLE_TWO
67Second example.
68.El
69.Pp
70The above value are defined in
71.Aq Pa example.h
72as follows:
73.Bd -literal
74#define EXAMPLE_ONE  1
75#define EXAMPLE_TWO  2
76.Ed
77.Sh RETURN VALUES
78.Rv -std example
79.Sh ENVIRONMENT
80The
81.Fn example
82library function ignores the
83.Ev EXAMPLE
84environment variable.
85.Sh FILES
86.Bl -tag -width /dev/null -compact
87.It Pa /dev/null
88Example of a file in the
89.Sx FILES
90section.
91.El
92.Sh SEE ALSO
93.Xr example 1 ,
94.Xr example 4 ,
95.Xr mdoc 7 ,
96.Xr mdoc.samples 7
97.Rs
98.%A A. B. Author
99.%T Example RFC Title
100.%O RFC0000
101.Re
102.Rs
103.%A A. B. Author
104.%B Example Book Title
105.%O ISBN-0-000-00000-0
106.Re
107.Rs
108.%A A. B. Author
109.%D January 1997
110.%J Example Journal Name
111.%T Example Article Title
112.Re
113.Sh STANDARDS
114If the command conforms to some standard, such as
115.St -p1003.2
116or
117.St -ansiC ,
118it should be noted here.
119.Sh DIAGNOSTICS
120None.
121.Sh ERRORS
122.\" Delete any errno's that are not returned by your
123.\" function or system call and then tailor the
124.\" remaining text as needed.
125.Fn Example
126will fail if:
127.Bl -tag -width Er
128.It Bq Er EPERM
129Operation not permitted.
130.It Bq Er ENOENT
131No such file or directory.
132.It Bq Er ESRCH
133No such process.
134.It Bq Er EINTR
135Interrupted system call.
136.It Bq Er EIO
137Input/output error.
138.It Bq Er ENXIO
139Device not configured.
140.It Bq Er E2BIG
141Argument list too long.
142.It Bq Er ENOEXEC
143Exec format error.
144.It Bq Er EBADF
145Bad file descriptor.
146.It Bq Er ECHILD
147No child processes.
148.It Bq Er EDEADLK
149Resource deadlock avoided.
150.It Bq Er ENOMEM
151Cannot allocate memory.
152.It Bq Er EACCES
153Permission denied.
154.It Bq Er EFAULT
155Bad address.
156.It Bq Er ENOTBLK
157Block device required.
158.It Bq Er EBUSY
159Device busy.
160.It Bq Er EEXIST
161File exists.
162.It Bq Er EXDEV
163Cross-device link.
164.It Bq Er ENODEV
165Operation not supported by device.
166.It Bq Er ENOTDIR
167Not a directory.
168.It Bq Er EISDIR
169Is a directory.
170.It Bq Er EINVAL
171Invalid argument.
172.It Bq Er ENFILE
173Too many open files in system.
174.It Bq Er EMFILE
175Too many open files.
176.It Bq Er ENOTTY
177Inappropriate ioctl for device.
178.It Bq Er ETXTBSY
179Text file busy.
180.It Bq Er EFBIG
181File too large.
182.It Bq Er ENOSPC
183No space left on device.
184.It Bq Er ESPIPE
185Illegal seek.
186.It Bq Er EROFS
187Read-only file system.
188.It Bq Er EMLINK
189Too many links.
190.It Bq Er EPIPE
191Broken pipe.
192.It Bq Er EDOM
193Numerical argument out of domain.
194.It Bq Er ERANGE
195Result too large.
196.It Bq Er EAGAIN
197Resource temporarily unavailable.
198.It Bq Er EWOULDBLOCK
199Operation would block.
200.It Bq Er EINPROGRESS
201Operation now in progress.
202.It Bq Er EALREADY
203Operation already in progress.
204.It Bq Er ENOTSOCK
205Socket operation on non-socket.
206.It Bq Er EDESTADDRREQ
207Destination address required.
208.It Bq Er EMSGSIZE
209Message too long.
210.It Bq Er EPROTOTYPE
211Protocol wrong type for socket.
212.It Bq Er ENOPROTOOPT
213Protocol not available.
214.It Bq Er EPROTONOSUPPORT
215Protocol not supported.
216.It Bq Er ESOCKNOTSUPORT
217Socket type not supported.
218.It Bq Er EOPNOTSUPP
219Operation not supported.
220.It Bq Er EPFNOSUPPORT
221Protocol family not supported.
222.It Bq Er EAFNNOSUPPORT
223Address family not supported by protocol family.
224.It Bq Er EADDRINUSE
225Address already in use.
226.It Bq Er EADDRNOTAVAIL
227Cannot assign requested address.
228.It Bq Er ENETDOWN
229Network is down.
230.It Bq Er ENETUNREACH
231Network is unreachable.
232.It Bq Er ENETRESET
233Network dropped connection on reset.
234.It Bq Er ECONNABORTED
235Software causes connection abort.
236.It Bq Er ENOBUFS
237No buffer space available.
238.It Bq Er EISCONN
239Socket is already connected.
240.It Bq Er ENOTCONN
241Socket is not connected.
242.It Bq Er ESHUTDOWN
243Cannot send after socket shutdown.
244.It Bq Er ETOOMANYREFS
245Too many references:  cannot splice.
246.It Bq Er ETIMEDOUT
247Operation timed out.
248.It Bq Er ECONNREFUSED
249Connection refused.
250.It Bq Er ELOOP
251Too many levels of symbolic links.
252.It Bq Er ENAMETOOLONG
253File name too long.
254.It Bq Er EHOSTDOWN
255Host is down.
256.It Bq Er EHOSTUNREACH
257No route to host.
258.It Bq Er ENOTEMPTY
259Directory not empty.
260.It Bq Er EPROCLIM
261Too many processes.
262.It Bq Er EUSERS
263Too many users.
264.It Bq Er EDQUOT
265Disc quota exceeded.
266.It Bq Er ESTALE
267Stale NFS file handle.
268.It Bq Er EREMOTE
269Too many levels of remote in path.
270.It Bq Er EBADRPC
271RPC struct is bad.
272.It Bq Er ERPCMISMATCH
273RPC version wrong.
274.It Bq Er EPROGUNAVAIL
275RPC program not available.
276.It Bq Er EPROGMISMATCH
277Program version wrong.
278.It Bq Er EPROCUNAVAIL
279Bad procedure for program.
280.It Bq Er ENOLCK
281No locks available.
282.It Bq Er ENOSYS
283Function not implemented.
284.It Bq Er EFTYPE
285Inappropriate file type or format.
286.It Bq Er EAUTH
287Authentication error.
288.It Bq Er ENEEDAUTH
289Need authenticator.
290.El
291.Sh HISTORY
292The
293.Nm
294manual page example first appeared in
295.Fx 2.2 .
296.Pp
297Some other common
298.Sx HISTORY
299section examples are:
300.Pp
301The
302.Nm
303manual page example first appeared in
304.Bx 4.4 .
305.Pp
306The
307.Nm
308manual page example first appeared in
309.At v6 .
310.Sh AUTHORS
311This
312manual page was written by
313.An Mike Pritchard Aq mpp@FreeBSD.org .
314.Sh BUGS
315The actual code for this function is vaporware.
316