]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - tools/tools/sysdoc/sysctl.sh
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / tools / tools / sysdoc / sysctl.sh
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5 # For each sysctl, repeat:
6 #       if it has a short description
7 #               sysctl.sh name "descr"
8 #       else
9 #               write its name to tunables.TODO with 'name missing description'
10 #               Note: This functionality is to point out which sysctls/tunables
11 #               have no description in the source.  This may be helpful for those
12 #               wishing to document the sysctls.
13 #
14
15 name="$1"
16 if [ X"${name}" = X"" ]; then
17         echo "usage: $(basename $0) sysctl-name" >&2
18         exit 1
19 fi
20
21
22 # Look up $name in tunables.mdoc
23
24 < tunables.mdoc \
25 sed -ne "/^${name}[[:space:]]*$/,/^---[[:space:]]*$/p" |        \
26 sed -e '/^---[[:space:]]*$/d' |                                 \
27
28 {                                                               \
29         read tmpname _junk;                                     \
30         if [ X"${tmpname}" = X"" ]; then                        \
31                 exit 0;                                         \
32         fi ;                                                    \
33         read type value _junk;                                  \
34         unset _junk;                                            \
35         if [ X"${type}" = X"" ]; then                           \
36                 echo "" >&2 ;                                   \
37                 echo "ERROR: Missing type for ${name}" >&2 ;    \
38         fi ;                                                    \
39         if [ X"${value}" = X"" ]; then                          \
40                 echo "" >&2 ;                                   \
41                 echo "ERROR: Missing default for ${name}" >&2 ; \
42         fi ;                                                    \
43
44         echo ".It Va ${tmpname}" ;                              \
45         if [ X"${type}" != X"" ]; then                          \
46                 echo ".Pq Vt ${type}" ;                         \
47         fi ;                                                    \
48         grep -v '^[[:space:]]*$' |                              \
49         sed -e "s/@default@/${value}/g" |                       \
50         sed -e "s/@type@/${type}/g" ;                           \
51 }