#! /bin/sh

# $Progeny$

# This program is in the public domain.

# Too bad we don't have something like sysexits.h for POSIX sh...
EX_USAGE=64

if [ $# -ne 2 ]; then
    exit ${EX_USAGE}
fi

refentry=$1.gen
name=$2

set -e

cat <<EOF > ${refentry}
  <refmeta>
    <refentrytitle>${name}</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>${name}</refname>
    <refpurpose>config script</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>${name}</command>
      <arg choice="opt">options</arg>
    </cmdsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>Description</title>

    <para><command>${name}</command> reports
    stuff about the package's configuration.</para>
  </refsect1>

  <refsect1>
    <title>Options</title>

    <variablelist>
      <varlistentry>
        <term><option>--VAR</option></term>
        <listitem>
          <para>Print the value of the variable VAR followed by a
          newline.  See below for a list of available
          variables.</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term><option>-l, --list-vars</option></term>
        <listitem>
          <para>List the available variables.</para>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsect1>

  <refsect1>
    <title>Variables</title>

    <itemizedlist>
EOF

cat >> ${refentry}

cat <<EOF >> ${refentry}
    </itemizedlist>
  </refsect1>
EOF

exit 0
