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