changeset 5:f0c7f45022c0

Add manpage
author Guido Berhoerster <guido+xwrited@berhoerster.name>
date Sun, 27 Apr 2014 23:12:06 +0200
parents f219f96f07c2
children c2ddd2f977d1
files Makefile data/docbook-update-source-data.xsl data/xwrited.1.xml data/xwrited.desktop.in po/POTFILES.in po/de.po xwrited.desktop.in
diffstat 7 files changed, 227 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun Apr 27 23:12:06 2014 +0200
+++ b/Makefile	Sun Apr 27 23:12:06 2014 +0200
@@ -42,11 +42,29 @@
 MSGFMT :=	msgfmt
 INTLTOOL_UPDATE := intltool-update
 INTLTOOL_MERGE := intltool-merge
+XSLTPROC :=	xsltproc
+DOCBOOK5_MANPAGES_STYLESHEET =	http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
+
+define generate-manpage-rule =
+%.$(1): %.$(1).xml
+	$$(XSLTPROC) \
+	    --xinclude \
+	    --stringparam package $$(PACKAGE) \
+	    --stringparam version $$(VERSION)\
+	    data/docbook-update-source-data.xsl $$< | \
+	    $$(XSLTPROC) \
+	    --xinclude \
+	    $$(DOCBOOK5_MANPAGES_FLAGS) \
+	    --output $$@ \
+	    $$(DOCBOOK5_MANPAGES_STYLESHEET) \
+	    -
+endef
 
 DESTDIR ?=
 prefix ?=	/usr/local
 bindir ?=	$(prefix)/bin
 datadir ?=	$(prefix)/share
+mandir ?=	$(datadir)/man
 localedir ?=	$(datadir)/locale
 sysconfdir ?=	/etc
 xdgautostartdir ?= $(sysconfdir)/xdg/autostart
@@ -82,7 +100,8 @@
 endif
 
 OBJS =		main.o xwrited-debug.o xwrited-unique.o $(OBJS_UTMP)
-AUTOSTART_FILE = $(PACKAGE).desktop
+MANPAGES =	data/$(PACKAGE).1
+AUTOSTART_FILE = data/$(PACKAGE).desktop
 MOFILES :=	$(patsubst %.po,%.mo,$(wildcard po/*.po))
 POTFILE =	po/$(PACKAGE).pot
 POSRCS :=	$(shell $(SED) -e 's/\#.*//' -e '/^[ \t]*$$/d' \
@@ -97,12 +116,14 @@
 		-DG_LOG_DOMAIN=\"$(PACKAGE)\"
 LDLIBS :=	$(EXTRA_LIBS) \
 		$(shell pkg-config --libs $(PKGCONFIG_LIBS))
+DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
+			  --stringparam man.copyright.section.enabled 0
 
 .DEFAULT_TARGET = all
 
 .PHONY: all clean clobber dist install
 
-all: $(PACKAGE) $(MOFILES) $(AUTOSTART_FILE)
+all: $(PACKAGE) $(MANPAGES) $(MOFILES) $(AUTOSTART_FILE)
 
 $(PACKAGE): $(OBJS)
 	$(LINK.o) $^ $(LDLIBS) -o $@
@@ -122,6 +143,8 @@
 	$(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
 	$(COMPILE.c) -o $@ $<
 
+$(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section))))
+
 %.desktop: %.desktop.in $(MOFILES)
 	$(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@
 
@@ -136,9 +159,11 @@
 	done
 	$(INSTALL.data) $(AUTOSTART_FILE) \
 	        "$(DESTDIR)$(xdgautostartdir)/$(notdir $(AUTOSTART_FILE))"
+	$(INSTALL.data) data/$(PACKAGE).1 \
+	        "$(DESTDIR)$(mandir)/man1/$(PACKAGE).1"
 
 clean:
-	rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE)
+	rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(MANPAGES) $(AUTOSTART_FILE)
 
 clobber: clean
 	rm -f $(patsubst %.o,%.d,$(OBJS))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data/docbook-update-source-data.xsl	Sun Apr 27 23:12:06 2014 +0200
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:db="http://docbook.org/ns/docbook"
+  xmlns="http://docbook.org/ns/docbook"
+  exclude-result-prefixes="xsl db">
+
+  <xsl:param name="package" select="''" />
+  <xsl:param name="version" select="''" />
+
+  <xsl:template match="db:refmeta/db:refmiscinfo[@class = 'source' or
+    @class = 'version']"/>
+
+  <xsl:template match="db:refmeta">
+    <xsl:copy>
+      <xsl:apply-templates/>
+      <refmiscinfo class="source"><xsl:value-of select="$package"/></refmiscinfo>
+      <refmiscinfo class="version"><xsl:value-of select="$version"/></refmiscinfo>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data/xwrited.1.xml	Sun Apr 27 23:12:06 2014 +0200
@@ -0,0 +1,159 @@
+<?xml version="1.0"?>
+<!--
+
+Copyright (C) 2014 Guido Berhoerster <guido+xwrited@berhoerster.name>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+-->
+<refentry xmlns="http://docbook.org/ns/docbook" xml:lang="en">
+  <info>
+    <author>
+      <personname>
+        <firstname>Guido</firstname>
+        <surname>Berhoerster</surname>
+      </personname>
+      <email>guido+xwrited@berhoerster.name</email>
+      <personblurb/>
+    </author>
+    <date>27 April, 2014</date>
+  </info>
+  <refmeta>
+    <refentrytitle>xwrited</refentrytitle>
+    <manvolnum>1</manvolnum>
+    <refmiscinfo class="source"/>
+    <refmiscinfo class="version"/>
+    <refmiscinfo class="manual">User Commands</refmiscinfo>
+  </refmeta>
+  <refnamediv>
+    <refname>xwrited</refname>
+    <refpurpose>display write and wall messages as desktop
+    notifications</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>sencrypt</command>
+      <arg choice="opt">
+        <option>-d</option>
+      </arg>
+      <arg choice="opt">
+        <option>-h</option>
+      </arg>
+      <arg choice="opt">
+        <option>-V</option>
+      </arg>
+      <arg choice="opt">
+        <option>-?</option>
+      </arg>
+      <arg choice="opt">
+        <option>--debug</option>
+      </arg>
+      <arg choice="opt">
+        <option>--help</option>
+      </arg>
+      <arg choice="opt">
+        <option>--version</option>
+      </arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>Description</title>
+    <para>The <command>xwrited</command> utility displays
+    <citerefentry><refentrytitle>write</refentrytitle><manvolnum>1</manvolnum>
+    </citerefentry> and
+    <citerefentry><refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum>
+    </citerefentry> messages as desktop notifications. A notification daemon
+    compliant to the freedesktop.org Desktop Notification Specification draft
+    needs to be running in order to display the notifications.</para>
+  </refsect1>
+  <refsect1>
+    <title>Options</title>
+    <para>The following options are supported:</para>
+    <variablelist>
+      <varlistentry>
+        <term>
+          <option>-h</option>
+        </term>
+        <term>
+          <option>-?</option>
+        </term>
+        <term>
+          <option>--help</option>
+        </term>
+        <listitem>
+          <para>Print a summary of all command line options and exit.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          <option>-d</option>
+        </term>
+        <term>
+          <option>--debug</option>
+        </term>
+        <listitem>
+          <para>Enable debugging output.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          <option>-V</option>
+        </term>
+        <term>
+          <option>--version</option>
+        </term>
+        <listitem>
+          <para>Print the version number and exit.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+  <refsect1>
+    <title>Exit Status</title>
+    <para>The following exit values are returned:</para>
+    <variablelist>
+      <varlistentry>
+        <term>0</term>
+        <listitem>
+          <para>Command successfully executed.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>&gt; 0</term>
+        <listitem>
+          <para>An error has occured.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+  <refsect1>
+    <title>See Also</title>
+    <para><citerefentry><refentrytitle>write</refentrytitle>
+    <manvolnum>1</manvolnum></citerefentry>,
+    <citerefentry> <refentrytitle>wall</refentrytitle><manvolnum>1</manvolnum>
+    </citerefentry></para>
+  </refsect1>
+  <refsect1>
+    <title>Notes</title>
+    <para>xwrited assumes that messages are encoded in UTF-8 because there is
+    no way for it to determine the character set encoding of the received
+    data.</para>
+  </refsect1>
+</refentry>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data/xwrited.desktop.in	Sun Apr 27 23:12:06 2014 +0200
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Encoding=UTF-8
+_Name=xwrited
+_Comment=Display write and wall messages as desktop notifications
+Exec=xwrited
+Terminal=false
+Type=Application
+Categories=System;Monitor;
--- a/po/POTFILES.in	Sun Apr 27 23:12:06 2014 +0200
+++ b/po/POTFILES.in	Sun Apr 27 23:12:06 2014 +0200
@@ -1,4 +1,4 @@
-xwrited.desktop.in
+data/xwrited.desktop.in
 main.c
 xwrited-debug.c
 xwrited-unique.c
--- a/po/de.po	Sun Apr 27 23:12:06 2014 +0200
+++ b/po/de.po	Sun Apr 27 23:12:06 2014 +0200
@@ -18,11 +18,11 @@
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
-#: ../xwrited.desktop.in.h:1
+#: ../data/xwrited.desktop.in.h:1
 msgid "xwrited"
 msgstr "xwrited"
 
-#: ../xwrited.desktop.in.h:2
+#: ../data/xwrited.desktop.in.h:2
 msgid "Display write and wall messages as desktop notifications"
 msgstr "Zeigt write und wall Nachrichten as Desktop-Benachrichtigungen an"
 
--- a/xwrited.desktop.in	Sun Apr 27 23:12:06 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-_Name=xwrited
-_Comment=Display write and wall messages as desktop notifications
-Exec=xwrited
-Terminal=false
-Type=Application
-Categories=System;Monitor;