summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-09-21 05:17:16 +0000
committerMike Frysinger <vapier@gentoo.org>2008-09-21 05:17:16 +0000
commit0136cbcd1f01c893e7333ac51599d9a436978dc8 (patch)
tree94c44577fe9775eadc680881c7fddd352ff70b40 /net-misc
parentVersion bump (diff)
downloadgentoo-2-0136cbcd1f01c893e7333ac51599d9a436978dc8.tar.gz
gentoo-2-0136cbcd1f01c893e7333ac51599d9a436978dc8.tar.bz2
gentoo-2-0136cbcd1f01c893e7333ac51599d9a436978dc8.zip
import man page gen scripts
Diffstat (limited to 'net-misc')
-rwxr-xr-xnet-misc/ntp/files/man-pages/genmans.sh68
-rw-r--r--net-misc/ntp/files/man-pages/ntp.xsl218
-rw-r--r--net-misc/ntp/files/man-pages/ntpdc.html.patch30
3 files changed, 316 insertions, 0 deletions
diff --git a/net-misc/ntp/files/man-pages/genmans.sh b/net-misc/ntp/files/man-pages/genmans.sh
new file mode 100755
index 000000000000..12857d886364
--- /dev/null
+++ b/net-misc/ntp/files/man-pages/genmans.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+#
+# ntpman.sh -- Create man pages for ntp
+#
+
+VERSION=$1
+if [[ -z ${VERSION} ]] ; then
+ VERSION=$(ls -1d ntp-*/ | LC_COLLATE=C sort | sed -n '${s:/::;p;Q}')
+ if [[ -z ${VERSION} ]] ; then
+ echo "Usage: $0 <version>"
+ exit 1
+ fi
+fi
+[[ ${VERSION} != ntp-* ]] && VERSION="ntp-${VERSION}"
+
+SRCDIR=${0%/*}
+HTMLDIR=${SRCDIR}/${VERSION}/html
+DISTFILE=/usr/portage/distfiles/${VERSION}.tar.gz
+MANDIR=man
+
+if [[ ! -d ${HTMLDIR} ]] ; then
+ if [[ -f ${DISTFILE} ]] ; then
+ tar zxf ${DISTFILE} -C ${SRCDIR} || exit 1
+ else
+ echo "ERROR: $HTMLDIR / $DISTFILE does not exist"
+ exit 1
+ fi
+fi
+
+# Process a single HTML file
+processfile() {
+ HTMLFILE=$1
+ MANFILE=$2
+ echo -n "Processing $HTMLFILE ..."
+ sed -e "s:<csobj.*<:csobj>/:" $HTMLDIR/$HTMLFILE > .$HTMLFILE
+ xsltproc --html --stringparam version $VERSION ntp.xsl .$HTMLFILE > $MANDIR/$MANFILE || exit 1
+ rm -f .$HTMLFILE
+ echo "Done."
+}
+
+# Print information
+echo "Generates ntp man files from HTML documentation. Using:"
+echo "VERSION: $VERSION"
+echo "HTMLDIR: $HTMLDIR"
+echo "MANDIR: $MANDIR"
+echo "Press enter to continue, or Ctrl-C to cancel."
+read
+
+# Apply patch if still needed
+(
+cd $HTMLDIR
+patch -p2 --dry-run < ../../ntpdc.html.patch -sf || exit 0
+patch -p2 < ../../ntpdc.html.patch
+)
+
+# Process HTML files
+rm -rf ${MANDIR}
+mkdir ${MANDIR}
+for f in ntp{date,dc,d,q,time,trace,dsim} keygen tickadj ; do
+ processfile ${f}.html ${f}.8
+done
+echo
+
+cp -vi /usr/local/src/freebsd/src/usr.sbin/ntp/doc/*.5 man/
+cp -vi *.patch genmans.sh ntp.xsl man/
+
+tar -jcf ${VERSION}-manpages.tar.bz2 ${MANDIR}
+du -b ${VERSION}-manpages.tar.bz2
diff --git a/net-misc/ntp/files/man-pages/ntp.xsl b/net-misc/ntp/files/man-pages/ntp.xsl
new file mode 100644
index 000000000000..ed9c1f8b8e51
--- /dev/null
+++ b/net-misc/ntp/files/man-pages/ntp.xsl
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!--
+Description:
+ Stylesheet for converting the HTML documentation
+ for various ntp commands into proper manual pages
+ (in troff format).
+
+Author:
+ Per Cederberg, <per at percederberg dot net>
+-->
+
+<!DOCTYPE stylesheet [
+<!ENTITY newline "
+">
+]>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+ <!-- ### INPUT PARAMETERS ### -->
+ <xsl:param name="version" select="''" />
+
+
+ <!-- ### OUTPUT DECLARATION ### -->
+ <xsl:output method="text"
+ encoding="ISO-8859-1" />
+
+ <xsl:strip-space elements="html" />
+
+
+ <!-- ### TEMPLATES ### -->
+ <xsl:template match="/">
+ <xsl:text>.\" Automatically generated from HTML source. </xsl:text>
+ <xsl:text>DO NOT EDIT!&newline;</xsl:text>
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="head">
+ <xsl:text>.TH </xsl:text>
+ <xsl:value-of select="substring-before(title, ' ')" />
+ <xsl:text> 1 "" "ntp </xsl:text>
+ <xsl:value-of select="$version" />
+ <xsl:text>"</xsl:text>
+ <xsl:text>&newline;</xsl:text>
+ <xsl:text>.SH NAME</xsl:text>
+ <xsl:text>&newline;</xsl:text>
+ <xsl:value-of select="title" />
+ <xsl:text>&newline;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="body">
+ <xsl:apply-templates select="*[preceding-sibling::hr]" />
+ </xsl:template>
+
+ <xsl:template match="h3">
+ </xsl:template>
+
+ <xsl:template match="h4">
+ <xsl:variable name="text">
+ <xsl:call-template name="stringToUpper">
+ <xsl:with-param name="str" select="." />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="name(preceding-sibling::*[1]) = 'tt'">
+ <xsl:text>&newline;</xsl:text>
+ </xsl:if>
+ <xsl:text>.SH </xsl:text>
+ <xsl:value-of select="$text" />
+ <xsl:text>&newline;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="address">
+ <xsl:text>.SH AUTHOR</xsl:text>
+ <xsl:text>&newline;</xsl:text>
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="p">
+ <xsl:variable name="text">
+ <xsl:apply-templates />
+ </xsl:variable>
+ <xsl:if test="starts-with($text, 'Disclaimer:')">
+ <xsl:text>&newline;</xsl:text>
+ </xsl:if>
+ <xsl:text>.P</xsl:text>
+ <xsl:text>&newline;</xsl:text>
+ <xsl:value-of select="$text" />
+ <xsl:text>&newline;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="dd/p">
+ <xsl:text>&newline;</xsl:text>
+ <xsl:text>&newline;</xsl:text>
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="hr">
+ </xsl:template>
+
+ <xsl:template match="pre">
+ <xsl:text>&newline;</xsl:text>
+ <xsl:text>.ft CW</xsl:text>
+ <xsl:text>&newline;</xsl:text>
+ <xsl:text>.nf</xsl:text>
+ <xsl:text>&newline;</xsl:text>
+ <xsl:call-template name="trim-newlines">
+ <xsl:with-param name="str" select="." />
+ </xsl:call-template>
+ <xsl:text>&newline;</xsl:text>
+ <xsl:text>.ft R</xsl:text>
+ <xsl:text>&newline;</xsl:text>
+ <xsl:text>.fi</xsl:text>
+ <xsl:text>&newline;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="ul">
+ </xsl:template>
+
+ <xsl:template match="nobr">
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates />
+ <xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="dl">
+ <xsl:apply-templates />
+ </xsl:template>
+
+ <xsl:template match="dt">
+ <xsl:text>.TP&newline;</xsl:text>
+ <xsl:text>.B </xsl:text>
+ <xsl:value-of select="normalize-space(.)" />
+ <xsl:text>&newline;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="dd">
+ <xsl:apply-templates />
+ <xsl:text>&newline;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="tr">
+ <xsl:if test="position() &gt; 1">
+ <xsl:apply-templates />
+ <xsl:text>&newline;</xsl:text>
+ <xsl:text>&newline;</xsl:text>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="tt">
+ <xsl:text>&newline;</xsl:text>
+ <xsl:text>\fB</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>\fR </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="i">
+ <xsl:text>&newline;</xsl:text>
+ <xsl:text>\fI</xsl:text>
+ <xsl:apply-templates />
+ <xsl:text>\fR </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="a">
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates />
+ <xsl:text> </xsl:text>
+ </xsl:template>
+
+ <xsl:template match="br">
+ <xsl:text>&newline;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="text()">
+ <xsl:value-of select="normalize-space(.)" />
+ </xsl:template>
+
+
+ <!-- ### HELPER FUNCTIONS ### -->
+ <xsl:template name="stringToUpper">
+ <xsl:param name="str" />
+ <xsl:value-of select="translate($str,
+ 'abcdefghijklmnopqrstuvwxyz',
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
+ </xsl:template>
+
+ <xsl:template name="trim-newlines">
+ <xsl:param name="str" />
+ <xsl:choose>
+ <xsl:when test="starts-with($str,'&newline;')">
+ <xsl:call-template name="trim-newlines">
+ <xsl:with-param name="str" select="substring($str, 2)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="trim-newlines-tail">
+ <xsl:with-param name="str" select="$str" />
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="trim-newlines-tail">
+ <xsl:param name="str" />
+ <xsl:variable name="len" select="string-length($str)" />
+ <xsl:choose>
+ <xsl:when test="substring($str,$len) = '&newline;'">
+ <xsl:call-template name="trim-newlines-tail">
+ <xsl:with-param name="str" select="substring($str, 1, $len - 1)" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$str" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/net-misc/ntp/files/man-pages/ntpdc.html.patch b/net-misc/ntp/files/man-pages/ntpdc.html.patch
new file mode 100644
index 000000000000..2a98c7b51f77
--- /dev/null
+++ b/net-misc/ntp/files/man-pages/ntpdc.html.patch
@@ -0,0 +1,30 @@
+--- ntp/html/ntpdc.html
++++ ntp/html/ntpdc.html
+@@ -131,11 +131,11 @@
+ <p>Authenticated requests always include a timestamp in the packet data, which is included in the computation of the authentication code. This timestamp is compared by the server to its receive time stamp. If they differ by more than a small amount the request is rejected. This is done for two reasons. First, it makes simple replay attacks on the server, by someone who might be able to overhear traffic on your LAN, much more difficult. Second, it makes it more difficult to request configuration changes to your server from topologically remote hosts. While the reconfiguration facility will work well with a server on the local host, and may work adequately between time-synchronized hosts on the same LAN, it will work very poorly for more distant hosts. As such, if reasonable passwords are chosen, care is taken in the distribution and protection of keys and appropriate source address restrictions are applied, the run time reconfiguration facility should provide an adequate level of security.</p>
+ <p>The following commands all make authenticated requests.</p>
+ <dl>
+- <dt><tt>addpeer <i>peer_address</i> [
++ <dt><tt>addpeer</tt> <i>peer_address</i> [
+ <i>keyid</i> ] [ <i>version</i> ] [
+ <tt>minpoll# | prefer | iburst | burst | minpoll
+ <i>N</i> | <tt>maxpoll</tt> <i>N</i> [...] ]</tt>
+- <dt><tt>addpeer <i>peer_address</i> [
++ <dt><tt>addpeer</tt> <i>peer_address</i> [
+ <tt>prefer | iburst | burst | minpoll
+ <i>N</i> | <tt>maxpoll</tt> <i>N</i> | <tt>keyid</tt>
+ <i>N</i> | <tt>version</tt> <i>N</i> [...] ]</tt>
+@@ -163,11 +163,11 @@
+ ntpd. See the <a href="confopt.html">Server Options</a> page for further information.
+ Each flag (or its absence) replaces the
+ previous setting. The <tt>prefer</tt> keyword indicates a preferred peer (and thus will be used primarily for clock synchronisation if possible). The preferred peer also determines the validity of the PPS signal - if the preferred peer is suitable for synchronisation so is the PPS signal.
+- <dt><tt>addserver <i>peer_address</i> [
++ <dt><tt>addserver</tt> <i>peer_address</i> [
+ <i>keyid</i> ] [ <i>version</i> ] [
+ <tt>minpoll# | prefer | iburst | burst | minpoll
+ <i>N</i> | <tt>maxpoll</tt> <i>N</i> [...] ]</tt>
+- <dt><tt>addserver <i>peer_address</i> [
++ <dt><tt>addserver</tt> <i>peer_address</i> [
+ <tt>prefer | iburst | burst | minpoll
+ <i>N</i> | <tt>maxpoll</tt> <i>N</i> | <tt>keyid</tt>
+ <i>N</i> | <tt>version</tt> <i>N</i> [...] ]</tt>