diff options
Diffstat (limited to 'debian/tmp/usr')
-rwxr-xr-x | debian/tmp/usr/bin/dhelp | 243 | ||||
-rwxr-xr-x | debian/tmp/usr/sbin/dhelp_parse | bin | 0 -> 46686 bytes | |||
-rw-r--r-- | debian/tmp/usr/share/doc/dhelp/debian.jpg | bin | 0 -> 8442 bytes | |||
-rw-r--r-- | debian/tmp/usr/share/doc/dhelp/dhelp.html | 189 | ||||
-rw-r--r-- | debian/tmp/usr/share/doc/dhelp/dhelp2dwww.pl | 49 | ||||
-rw-r--r-- | debian/tmp/usr/share/doc/dhelp/folder.png | bin | 0 -> 230 bytes | |||
-rw-r--r-- | debian/tmp/usr/share/doc/dhelp/sgml2dhelp.pl | 129 | ||||
-rw-r--r-- | debian/tmp/usr/share/doc/dhelp/swirl.jpg | bin | 0 -> 3986 bytes | |||
-rw-r--r-- | debian/tmp/usr/share/doc/dhelp/text.png | bin | 0 -> 231 bytes |
9 files changed, 610 insertions, 0 deletions
diff --git a/debian/tmp/usr/bin/dhelp b/debian/tmp/usr/bin/dhelp new file mode 100755 index 0000000..c631b7f --- /dev/null +++ b/debian/tmp/usr/bin/dhelp @@ -0,0 +1,243 @@ +#!/usr/bin/perl -w +# +# Copyright 2002 by Stefan Hornburg (Racke) <racke@linuxia.de> +# +# Based on a sample implementation of Chris Tillman +# <tillman@azstarnet.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA. + +use strict; +use warnings; + +# module setup +use File::Spec; +use File::Temp qw(tempfile); +use IO::Socket; +use Getopt::Long; +use Pod::Usage; + +# version (replaced on packaging time) +my $version = '0.5.18'; + +# process commandline options +my %opts; +my $whandler = $SIG{__WARN__}; +$SIG{__WARN__} = sub {print STDERR "$0: @_";}; +unless (GetOptions(\%opts, + 'file|f', + 'help|h', + 'version')) { + die(pod2usage(1)); +} + +if ($opts{help}) { + pod2usage(1); + exit 0; +} elsif ($opts{version}) { + print "dhelp version $version\n"; + exit 0; +} + +my $searchterm = shift; + +# home directory of the current user +my $homedir; + +if (exists $ENV{'HOME'} && -d $ENV{'HOME'}) { + $homedir = $ENV{'HOME'}; +} else { + $homedir = (getpwent()) [7]; +} + +# determine browser to use +my $browser; + +if ($ENV{'BROWSER'}) { + # use user-supplied value + $browser = $ENV{'BROWSER'}; +} elsif ($ENV{'DISPLAY'}) { + # X Window System in charge + $browser = &conf_from_flist("$homedir/.dhelp/www-browser-x", + '/etc/dhelp/www-browser-x'); +} else { + # Fallback to console browser + $browser = &conf_from_flist("$homedir/.dhelp/www-browser-console", + '/etc/dhelp/www-browser-console'); +} + +unless ($browser) { + die "$0: No browser defined.\n"; +} + +unless (&available($browser)) { + die "$0: Browser $browser not executable.\n"; +} + +my $httpd_running = ''; + +unless ($opts{file}) { + # check if there is a CGI capable WWW server running on the localhost + my $testdoc = "/doc/HTML/index.html"; + my $eol = "\015\012"; + my $blank = $eol x 2; + my $sock = IO::Socket::INET->new('127.0.0.1:80'); + + if ($sock) { + $sock->autoflush(1); + print $sock "HEAD $testdoc HTTP/1.0$eol"; + print $sock "Host: localhost" . $blank; + + while (my $line = <$sock>) { + if ($line =~ s/^Server: //) { + $httpd_running = $line; + } + } + close $sock; + + if ($httpd_running =~ /dhttpd/) { + # this server is not CGI capable + $httpd_running = ''; + } + } +} + +my $document; + +if ($httpd_running) { + # we can query the web server directly + if ($searchterm) { + $document="http://localhost/cgi-bin/dsearch?search=$searchterm"; + } else { + $document="http://localhost/doc/HTML/index.html"; + } + print "Starting $browser (using HTTP $httpd_running) ...\n"; +} else { + if ($searchterm) { + my ($basedir) = File::Spec->tmpdir(); + my ($fh, $tmpfile) = tempfile ('dhelp' . 'X' x 6, + DIR => $basedir, + SUFFIX => '.html', + UNLINK => 1); + print "Starting dsearch for $searchterm\n"; + # call dsearch + open (DSEARCH, "/usr/lib/cgi-bin/dsearch file=1 search=$searchterm|"); + while (<DSEARCH>) { + print $fh $_; + } + close (DSEARCH) || die "$0: dsearch failed\n"; + system ( "$browser $tmpfile" ) and die( "${browser}: Failed to open $tmpfile: $!\n" ); + exit 0; + } else { + $document="/usr/share/doc/HTML/index.html"; + print "Starting $browser (using local filesystem) ...\n"; + } +} + +system ( "$browser $document" ) and die( "${browser}: Failed to open $document: $!\n" ); + +# -------------------------------------------- +# FUNCTION: available PROGRAM +# +# Checks if PROGRAM is available for the user. +# -------------------------------------------- + +sub available { + my $program = shift; + + if ($program =~ m%/%) { + # no need to search the path + return -x $program; + } + + for (split(/:/, $ENV{PATH})) { + return 1 if -x "$_/$program"; + } +} + +# ------------------------------------------------------ +# FUNCTION: conf_from_flist FILE [FILE ...] +# +# Takes a list of files. Reads the first string which is +# not in a commented or empty line from the first +# existing file in the list, strips surrounding blanks +# and returns the resulting string. +# ------------------------------------------------------ + +sub conf_from_flist { + my $ret; + + for my $file (@_) { + next unless -f $file; + open (CONF, $file) + || die "Couldn't open configuration file $file: $!\n"; + while (<CONF>) { + next if /^\#/; + last if /\S/; + chomp; + } + close (CONF); + next unless defined $_; + $ret = $_; + $ret =~ s/^\s+//; + $ret =~ s/\s+$//; + return $ret; + } +} + +__END__ + + +=head1 NAME + +dhelp: Accessing Debian Online Help System + +=head1 SYNOPSIS + + dhelp [ -h | -v | search-term ] + dhelp -f + +=head1 OPTIONS + +=over 8 + +=item B<-f, --file> + +Direct the browser to use the local file system instead of +contacting the local WWW server. + +=item B<-h, --help> + +Show a brief help message and exit. + +=item B<-v, --version> + +Show the program version number and exit. + +=back + +=head1 DESCRIPTION + +B<dhelp> presents a list of installed html documentation. The +list can be browsed directly with Lynx, or if a web server +is installed then any web browser can be used. + +In addition, you can search for terms indexed in the documentation +using B<dhelp search-term> . + +=cut + + diff --git a/debian/tmp/usr/sbin/dhelp_parse b/debian/tmp/usr/sbin/dhelp_parse Binary files differnew file mode 100755 index 0000000..97d5425 --- /dev/null +++ b/debian/tmp/usr/sbin/dhelp_parse diff --git a/debian/tmp/usr/share/doc/dhelp/debian.jpg b/debian/tmp/usr/share/doc/dhelp/debian.jpg Binary files differnew file mode 100644 index 0000000..db62d7a --- /dev/null +++ b/debian/tmp/usr/share/doc/dhelp/debian.jpg diff --git a/debian/tmp/usr/share/doc/dhelp/dhelp.html b/debian/tmp/usr/share/doc/dhelp/dhelp.html new file mode 100644 index 0000000..00e2f5c --- /dev/null +++ b/debian/tmp/usr/share/doc/dhelp/dhelp.html @@ -0,0 +1,189 @@ +<HTML> +<TITLE>dhelp</TITLE> +<BODY BGCOLOR=#FFFFFF> +<IMG SRC="debian.jpg" ALT="Debian GNU/Linux"><p> +<H1>dhelp</H1> + +<H2>What's dhelp?</H2> +dhelp is an online help system for Debian GNU/Linux. A Debian package +can register its HTML documents and dhelp builds an index of +all documents. + +The user doesn't need a WWW server to browse the HTML tree. + +<H2>How to use dhelp</H2> +If you have installed a WWW server on your system simply browse +<BLOCKQUOTE><TT><A HREF="http://localhost/doc/HTML/index.html"> +http://localhost/doc/HTML/index.html</A></TT></BLOCKQUOTE><P> + +If you haven't installed a WWW server use the dhelp command: + +<BLOCKQUOTE>$ dhelp</BLOCKQUOTE> + +<H2>The .dhelp file</H2> + +Programs supporting dhelp have to install a <tt>.dhelp</tt> file +in every directory under <tt>/usr/share/doc</tt>. For every HTML file that +should appear in the dhelp index the <tt>.dhelp</tt> file have to contain +the following section:<P> + +<DL> +<DT><TT><item></TT> +<DT><TT><directory></TT> +<DD>Defines in which section of the index the document should be linked. + I suggest that you use the same names like in <em>Section:</em> + in <tt>control</tt>. For example for a game you would use + <tt>games</tt>. A German document should linked to <tt>de/games</tt> + and so on. + You can find all supported sections in + <tt><A HREF=".dhelp">.dhelp</A></tt>. You can create additional + sections if necessary. +<DT><TT><dirtitle></TT> +<DD>Defines the title of a new section. +<DT><TT><linkname></TT> +<DD>This short text appears as link text in the index. This + is typical the filename without the <tt>.html suffix</tt>. +<DT><TT><filename></TT> +<DD>The filename of the HTML file with a path relative to the + <tt>.dhelp</tt> file. If your document is called + <tt>/usr/share/doc/dhelp/test.html</tt> and the <tt>.dhelp</tt> + is installed in <tt>/usr/share/doc/dhelp</tt> you must use + <tt>test.html</tt>. +<DT><PRE> +<description> +... +</description> +</PRE> +<DD> +A long description of the content of the document (optional). +<DT><TT></item></TT> +</DL><P> + +You can have only one tag per line! Something like the following will +not work:<P> + +<PRE> +<item><directory>de/foo + <dirtitle>The foo section + <linkname>foo + <filename>foo.html +<descrip>foo foo foo</descrip></item> +</PRE> + +You have to use this:<P> + +<PRE> +<item> +<directory>de/foo +<dirtitle>The foo section +<linkname>foo +<filename>foo.html +<descrip> +foo foo foo +</descrip> +</item> +</PRE> + +You can have several <item> sections in one <tt>.dhelp</tt> +file. + + +<H2>Add a .dhelp file to the index</H2> + +To add a <tt>.dhelp</tt> file to the document index you have +to call <tt>dhelp_parse</tt>:<P> + +<BLOCKQUOTE># dhelp_parse -a /usr/share/doc/directory</BLOCKQUOTE> + +I would suggest to add the following to your package <tt>postinst</tt> +script:<P> + +<BLOCKQUOTE><PRE> +if [ -f /usr/sbin/dhelp_parse ]; then + /usr/sbin/dhelp_parse -a /usr/share/doc/directory +fi +</PRE></BLOCKQUOTE><P> + +In <tt>prerm</tt> you should use:<P> + +<BLOCKQUOTE><PRE> +if [ -f /usr/sbin/dhelp_parse ]; then + /usr/sbin/dhelp_parse -d /usr/share/doc/directory +fi +</PRE></BLOCKQUOTE><P> + +<!-- +If your package conforms to the latest policy, the <tt>postinst</tt> +script should look like this:<P> + +<BLOCKQUOTE><PRE> +if [ -f /usr/sbin/dhelp_parse ]; then + /usr/sbin/dhelp_parse -a /usr/share/doc/directory +fi + +if [ -f /usr/sbin/dhelp_parse_fsstnd ]; then + /usr/sbin/dhelp_parse_fsstnd -a /usr/doc/directory +fi +</PRE></BLOCKQUOTE><P> + +In <tt>prerm</tt> you should use:<P> + +<BLOCKQUOTE><PRE> +if [ -f /usr/sbin/dhelp_parse ]; then + /usr/sbin/dhelp_parse -d /usr/share/doc/directory +fi + +if [ -f /usr/sbin/dhelp_parse_fsstnd ]; then + /usr/sbin/dhelp_parse_fsstnd -d /usr/doc/directory +fi +</PRE></BLOCKQUOTE><P> +--> + +Or you can use the script <tt>dh_dhelp</tt>. This script installs +the <tt>debian/dhelp</tt> file in <tt>/usr/share/doc/package</tt> and +creates the <tt>postinst</tt> and <tt>prerm</tt> scripts of all +<tt>.dhelp</tt> files found in <tt>/usr/share/doc</tt>. + + +<H2>Scripts for .dhelp file</H2> + +<H3>sgml2dhelp</H3> + +If the HTML files were produced by the sgml-tools (linuxdoc-sgml) +you can use the script <tt><a href="sgml2dhelp.pl">sgml2dhelp.pl</a></tt>. +This script produces a <tt>.dhelp</tt>, a <tt>.dwww-index</tt>, +and a <tt>index.html</tt> file.<P> + +Run this script in every directory containing HTML files. +You have to call the script with to options:<P> + +<BLOCKQUOTE> +<b>sgml2dhelp</b> <i><dhelp section> <dwww section></i> +</BLOCKQUOTE> + +If your documents should go in the German HOWTO section for example, you +have to enter:<P> + +<BLOCKQUOTE><TT># dhelp.build de/HOWTO general</TT></BLOCKQUOTE> <P> + +<h3>dhelp2dwww</h3> + +If you have written a <tt>.dhelp</tt>, you can convert it to +a <tt>.dwww-index</tt> file with the script +<tt><a href="dhelp2dwww.pl">dhelp2dwww.pl</a></tt>.<p> + +<blockquote> +<b>dhelp2dwww</b> <i><dwww section></i> +</blockquote> + +<H2>What can I do for dhelp?</H2> + +If you like dhelp please ask maintainers of Debian packages including +HTML documentation to add dhelp support.<P> + +If you have any comments or problems please feel free to send +an email to the dhelp package maintainer: +<A HREF="mailto:dhelp@packages.debian.org">dhelp@packages.debian.org</A> + +</BODY> +</HTML>
\ No newline at end of file diff --git a/debian/tmp/usr/share/doc/dhelp/dhelp2dwww.pl b/debian/tmp/usr/share/doc/dhelp/dhelp2dwww.pl new file mode 100644 index 0000000..d504df1 --- /dev/null +++ b/debian/tmp/usr/share/doc/dhelp/dhelp2dwww.pl @@ -0,0 +1,49 @@ +#!/usr/bin/perl -w + +# Copyright (c) 1998 by Marco Budde (Budde@tu-harburg.de) +# GNU General Public License + +################################################## +# converts a .dhelp file to a .dwww-index file # +# # +# usage: dhelp2dwww <dwww section> # +################################################## + + +############## +# main # +############## + +print ".dhelp -> .dwww-index\n"; + +$pwd = `pwd`; +$pwd =~ /.*?\/usr\/doc\/(.*)/; +$pwd = $1; + +open (IN, "< .dhelp") or die "can't open .dhelp!\n"; +open (OUT, "> .dwww-index") or die "can't open .dwww-index!\n"; + +while ($zw = <IN>) +{ + $descrip = ''; + while ($zw !~ /<\/item>/) + { + $linkname = $1 if ($zw =~ /<linkname>(.*)/); + $filename = $1 if ($zw =~ /<filename>(.*)/); + if ($zw =~ /<description>/) + { + while ($zw !~ /<\/description>/) + { + $zw = <IN>; + $descrip = $descrip . $zw if ($zw !~ /<\/description>/); + } + } + $zw = <IN>; + } + print OUT "#section $ARGV[0]\n"; + print OUT "<dt><a href=\"$pwd/$filename\">$linkname</a>\n"; + print OUT "<dd>$descrip\n"; +} + +close (IN); +close (OUT); diff --git a/debian/tmp/usr/share/doc/dhelp/folder.png b/debian/tmp/usr/share/doc/dhelp/folder.png Binary files differnew file mode 100644 index 0000000..654c048 --- /dev/null +++ b/debian/tmp/usr/share/doc/dhelp/folder.png diff --git a/debian/tmp/usr/share/doc/dhelp/sgml2dhelp.pl b/debian/tmp/usr/share/doc/dhelp/sgml2dhelp.pl new file mode 100644 index 0000000..035108d --- /dev/null +++ b/debian/tmp/usr/share/doc/dhelp/sgml2dhelp.pl @@ -0,0 +1,129 @@ +#!/usr/bin/perl -w + +# Copyright (c) 1998 by Marco Budde (Budde@tu-harburg.de) +# GNU General Public License + +############################################################## +# sgmltools -> dhelp, dwww, index.html # +# # +# usage: sgml2dhelp <dhelp section> <dwww section> # +############################################################## + +# you +$maintainer = 'Marco Budde (Budde@tu-harburg.de)'; + +# regexp to find the root html file of a document +$file_expr = '^(.+)[^0-9]\.html$'; + +# regexp to produce a link name from the file name +$title_expr = '^(.+)\.html$'; + + +############################## +# get abstract of document # +############################## + +sub get_abstract +{ + my $zw; + + open (IN, "< $filename") or die "can't open $filename!\n"; + $abstract = ''; + while ($zw = <IN>) + { + if ($zw =~ /<P><HR><EM>(.*)/) + { + $abstract = $1; + while ($zw !~ /<\/EM><HR><\/P>/) + { + $zw = <IN>; + $abstract .= ' ' . $zw; + } + } + } + $abstract =~ s/<\/EM><HR><\/P>//; + close (IN); +} + + +################## +# write .dhelp # +################## + +sub write_dhelp +{ + print DHELP "<item>\n"; + print DHELP "<directory>$ARGV[0]\n"; + print DHELP "<linkname>$linkname\n"; + print DHELP "<filename>$filename\n"; + print DHELP "<description>\n$abstract\n</description>\n"; + print DHELP "</item>\n\n"; +} + + +######################### +# .dwww-index support # +######################### + +sub dwww_pwd +{ + $pwd = `pwd`; + $pwd =~ /.*?\/usr\/doc\/*(.*)/; + $pwd = $1; +} + +sub write_dwww +{ + print DWWW "#section $ARGV[1]\n"; + print DWWW "<dt><a href=\"$pwd/$filename\">$linkname</a>\n"; + print DWWW "<dd>$abstract\n\n"; +} + +######################## +# index.html support # +######################## + +sub write_index +{ + print INDEX "<DT><A HREF=\"$filename\">$linkname</A>\n"; + print INDEX "<DD>$abstract\n\n"; +} + + +################ +# main # +################ + +opendir (DIRHANDLE, '.'); +@dircontent = readdir (DIRHANDLE); +closedir (DIRHANDLE); + +open (DHELP, "> .dhelp"); +open (INDEX, "> index.html"); +print INDEX "<HTML>\n<BODY BGCOLOR=#FFFFFF>\n<DL>\n"; +open (DWWW, "> .dwww-index"); +&dwww_pwd; + +foreach $filename (sort @dircontent) +{ + if ($filename =~ /$file_expr/) + { + $filename =~ /$title_expr/; + $linkname = $1; + print "$filename\n"; + &get_abstract; + &write_dhelp; + &write_index; + &write_dwww; + } +} + +close (DHELP); +print INDEX "</DL>\n<HR>\n<ADDRESS><SMALL>\n"; +print INDEX "Please send comments to $maintainer.\n"; +$time = gmtime (time); +print INDEX "<BR>This page was created $time GMT.</SMALL></ADDRESS>\n"; +print INDEX "</BODY>\n</HTML>\n"; +close (INDEX); +close (DWWW); + diff --git a/debian/tmp/usr/share/doc/dhelp/swirl.jpg b/debian/tmp/usr/share/doc/dhelp/swirl.jpg Binary files differnew file mode 100644 index 0000000..542f0a4 --- /dev/null +++ b/debian/tmp/usr/share/doc/dhelp/swirl.jpg diff --git a/debian/tmp/usr/share/doc/dhelp/text.png b/debian/tmp/usr/share/doc/dhelp/text.png Binary files differnew file mode 100644 index 0000000..399ef4a --- /dev/null +++ b/debian/tmp/usr/share/doc/dhelp/text.png |