xref: /freebsd/share/examples/mdoc/example.3 (revision 9a78dbdeb7552283b59d09210a9fa99f78fecc86)
1.\" Copyright (c) [year]
2.\"	[you name here].  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. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by [you name]
15.\"	and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY [you name] AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"
33.Dd "January 2, 1997"
34.Dt EXAMPLE 3
35.\" Note: Only specify the operating system when the command
36.\" is FreeBSD specific, otherwise use the .Os macro with no
37.\" arguments.
38.Os FreeBSD 3.0
39.Sh NAME
40.Nm example
41.Nd example library function manual page
42.Sh SYNOPSIS
43.Fd #include <example.h>
44.Ft int
45.Fn example "char *ptr" "int mode"
46.Sh DESCRIPTION
47This is an example library function manual page for
48the
49.Fn example
50function.  It is intended
51that this example can be used as a template when writing
52a new manual page.
53.Pp
54The
55.Fn example
56function takes two arguments:
57.Fa ptr
58and
59.Fa mode .
60The argument
61.Fa mode
62may have one of the following values:
63.Bl -tag -width EXAMPLE_ONE
64.It Dv EXAMPLE_ONE
65First example of a defined variable.
66.Dv EXAMPLE_ONE is described below.
67.It Dv EXAMPLE_TWO
68Second example.
69.El
70.Pp
71The above value are defined in
72.Aq example.h
73as follows:
74.Bd -literal
75#define EXAMPLE_ONE  1
76#define EXAMPLE_TWO  2
77.Ed
78.Sh RETURN VALUES
79A 0 value is returned if the operation succeeds,
80otherwise
81.Fn example
82returns -1 and the global variable
83.Va errno
84indicates the reason for the falure.
85.Sh ENVIRONMENT
86The
87.Fn example
88library function ignores the
89.Ev EXAMPLE
90environment variable.
91.Sh FILES
92.Bl -tag -width /dev/null -compact
93.It Pa /dev/null
94Example of a file in the
95.Sx FILES
96section.
97.El
98.Sh SEE ALSO
99.Xr example 1 ,
100.Xr example 4 ,
101.Xr mdoc 7 ,
102.Xr mdoc.samples 7
103.Sh STANDARDS
104If the command conforms to some standard, such as
105.St -p1003.2
106or
107.St -ansiC ,
108it should be noted here.
109.Sh DIAGNOSTICS
110None.
111.Sh ERRORS
112.Fn Example
113will fail if:
114.Bl -tag -width Er
115.It Bq Er EINVAL
116One of the arguments passed to
117.Fn example
118was invalid.
119.It Bq Er EPERM
120The caller did not have permission to
121use the
122.Fn example
123function.
124.El
125.Sh HISTORY
126The
127.Nm
128manual page example first appeared in
129.Fx 3.0 .
130.Sh AUTHOR
131This
132manual page was written by Mike Pritchard
133.Aq mpp@FreeBSD.ORG .
134.Sh BUGS
135The actual code for this function is vaporware.
136