Date: Sun, 19 Sep 1999 21:45:29 +0100 (BST) From: Andrew Boothman <andrew@cream.org> To: Nik Clayton <nik@freebsd.org> Cc: ports@freebsd.org, doc@freebsd.org Subject: RE: Building a page of installed software docs Message-ID: <XFMail.990919214529.andrew@cream.org> In-Reply-To: <XFMail.990918232222.andrew@cream.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 18-Sep-99 Andrew Boothman wrote: > FAQ txt /usr/local/share/doc/Sharity-Light/FAQ > README txt /usr/local/share/doc/Sharity-Light/README > > I made this file up for Sharity Light as an example. If the port has a docs > file, then the script produces a nice set of links to each type of > documentation. I've changed the seperator for the file to a colon. Many thanks to Slaven Rezic for pointing out that it's just possible that there might be some whitespace in the title of a document! :-) Plus, I've taken out the dash that went in after the name of the port, because it looked a bit stupid. :-) Script is now : #!/usr/bin/perl -w # Produces an HTML list of documentation installed by # the FreeBSD ports system. Intended to be run daily # from /var/periodic/daily # By Andrew Boothman <andrew@cream.org> opendir 'portsdir', '/var/db/pkg' or die "docindex: Can't open /var/db/pkg"; @allfiles = readdir 'portsdir'; closedir 'portsdir'; print '<HTML> <HEAD> <TITLE>Installed FreeBSD Documentation</TITLE> </HEAD> <BODY> <H2>Installed FreeBSD Documentation</H2> <HR> <UL>'; foreach(@allfiles){ if (-e "/var/db/pkg/$_/+DOCS") { open 'DOCS',"/var/db/pkg/$_/+DOCS"; @docs = <DOCS>; close 'DOCS'; chomp @docs; print "<LI>$_ <UL>"; foreach(@docs) { @docinfo = split(/:/); print "<LI>$docinfo[0] - [<A HREF=\"$docinfo[2]\">$docinfo[1]</A>]\n"; }; print "</UL>\n" }; }; print "</UL></BODY></HTML>"; (Watch out for weird wrapping of lines by your e-mail client. There should only be a newline where is a semicolon) And example file for Sharity Light is : FAQ:txt:/usr/local/share/doc/Sharity-Light/FAQ README:txt:/usr/local/share/doc/Sharity-Light/README Also, speaking for myself, my machine rarely gets to run its' daily script. So, certainly for my own use, it would be better to have the script run from rc. What does everyone think? --- Andrew Boothman <andrew@cream.org> http://sour.cream.org Unmetered Telecoms. Join the Fight! http://www.unmetered.org.uk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.990919214529.andrew>