summaryrefslogtreecommitdiff
path: root/doc/tech-notes/pnuts.4tech-notes
diff options
context:
space:
mode:
authorEduardo Chappa <echappa@gmx.com>2013-02-03 00:59:38 -0700
committerEduardo Chappa <echappa@gmx.com>2013-02-03 00:59:38 -0700
commit094ca96844842928810f14844413109fc6cdd890 (patch)
treee60efbb980f38ba9308ccb4fb2b77b87bbc115f3 /doc/tech-notes/pnuts.4tech-notes
downloadalpine-094ca96844842928810f14844413109fc6cdd890.tar.xz
Initial Alpine Version
Diffstat (limited to 'doc/tech-notes/pnuts.4tech-notes')
-rwxr-xr-xdoc/tech-notes/pnuts.4tech-notes134
1 files changed, 134 insertions, 0 deletions
diff --git a/doc/tech-notes/pnuts.4tech-notes b/doc/tech-notes/pnuts.4tech-notes
new file mode 100755
index 00000000..33e8d49f
--- /dev/null
+++ b/doc/tech-notes/pnuts.4tech-notes
@@ -0,0 +1,134 @@
+#!/usr/local/bin/perl
+#################################################
+#pnuts version 0.4 part of the WN server package
+#################################################
+# for more info, see http://hopf.math.nwu.edu/docs/utility.html#pnuts
+# Modified by Stefan Kramer for use with Pine Technical Notes
+# Last modified on 1995 Nov. 02
+
+
+require "getopts.pl";
+
+# Edit to specify what should appear as text of navigation bar. Note:
+# If the HTML files processed by PNUTS will be converted to plain-text files,
+# the PNUTS-generated link text will probably be stripped out, so this
+# text should be unique (i.e., not expected to occur elsewhere in text).
+
+# This is the original link appearance, without graphic buttons
+# $prevw="<b>Previous</b>";
+# $nextw="<b>Next</b>";
+# $upw="<b>Up one level</b>";
+# $topw="<b>Table of Contents</b>";
+# $searchw="<b>Search</b>";
+# $indexw="<b>Index</b>";
+
+$prevw='<IMG SRC="../graphics/BPprev.gif" ALT="[Previous]">';
+$nextw='<IMG SRC="../graphics/BPnext.gif" ALT="[Next]">';
+$upw=''; # not needed and don't have a graphic for UP
+$topw='<IMG SRC="../graphics/BPtoc.gif" ALT="[Table of Contents]">';
+$searchw='<IMG SRC="../graphics/BPsearch.gif" ALT="[Search]">';
+$indexw=''; # no index here and no graphic for it
+
+
+
+$VERSION = "0.4";
+
+ &Getopts('s:i:');
+ $search = $opt_s if $opt_s ne "";
+ $index = $opt_i if $opt_i ne "";
+
+ $file = shift;
+ $marker = "<!-- pnuts -->";
+
+
+ open( LIST, "<$file") || die "Can't open file: $!";
+
+
+ $nextfile = <LIST>;
+ print $nextfile;
+ chop( $nextfile);
+ $top = $nextfile;
+
+ while ( &getnextfile() ) {
+ $curcopy = $currentfile."~";
+
+ rename( $currentfile, $curcopy)
+ || die "Can't rename file: $currentfile";
+ open( OLDCURR, "<$curcopy" ) || die "Can't open file: $!";
+ open( NEWCURR, ">$currentfile" ) || die "Can't open file: $!";
+ while ( $line = <OLDCURR>) {
+ if ( $line =~ "^$marker") {
+ &pnutline();
+ }
+ else {
+ print NEWCURR $line;
+ }
+ }
+ close( OLDCURR);
+ close( NEWCURR);
+ }
+
+
+close( LIST);
+exit(0);
+
+sub pnutline {
+ printf( NEWCURR "$marker");
+ printf( NEWCURR "<P><HR>");
+ if ( $previous ) {
+ printf( NEWCURR " <a href=\"%s\">$prevw</a>", $previous);
+ }
+ if ( $nextfile ) {
+ printf( NEWCURR " <a href=\"%s\">$nextw</a>", $nextfile);
+ }
+ if ( $up[$curlevel - 1] ) {
+ printf( NEWCURR " <a href=\"%s\">$upw</a>",
+ $up[$curlevel-1]);
+ }
+ if ( $top && ( $top ne $currentfile) ) {
+ printf( NEWCURR " <a href=\"%s\">$topw</a>", $top);
+ }
+ if ( $search ) {
+ printf( NEWCURR " <a href=\"%s\">$searchw</a>", $search);
+ }
+ if ( $index ) {
+ printf( NEWCURR " <a href=\"%s\">$indexw</a>", $index);
+ }
+ printf( NEWCURR "\n");
+}
+
+sub getnextfile {
+ if ( $nextfile eq "") {
+ return 0;
+ }
+ $previous = $currentfile;
+ $up[$curlevel] = $currentfile;
+
+ $currentfile = $nextfile;
+ while ( 1 ) {
+ ($nextfile = <LIST>) || ($nextfile = "");
+ $nextfile =~ s/(\t*)//;
+ last if $nextfile eq "";
+ print $nextfile;
+ chop( $nextfile);
+ if ( -d $nextfile ) {
+ print "$nextfile is directory, ignoring it\n";
+ next;
+ }
+ last;
+ }
+ $curlevel = $nextlevel;
+ $nextlevel = length( $1);
+ return 1;
+}
+
+
+
+
+
+
+
+
+
+
+