Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / doc / MHonArc / faq / _helper / addbuttons.pl
CommitLineData
86530b38
AT
1#!/usr/local/bin/perl
2#
3# $Date: 2001/09/05 16:04:08 $
4
5for ($i=0; $i <= $#ARGV; $i++) {
6 $file = $ARGV[$i];
7 system("/bin/cp $file $file.$$");
8 open(IN, "$file.$$") or die "Unable to open $file\n";
9 open(OUT, ">$file") or die "Unable to create $file\n";
10
11 while (<IN>) {
12 print OUT $_;
13 if (/<!--X-NavButtons-Start-->/) {
14 while (<IN>) {
15 last if /<!--X-NavButtons-End-->/;
16 }
17 print OUT "<p align=center>\n";
18 if ($i > 0) {
19 print OUT qq{[<a href="}, $ARGV[$i-1], qq{">Prev</a>]};
20 } else {
21 print OUT qq{[Prev]};
22 }
23 if ($i < $#ARGV) {
24 print OUT qq{[<a href="}, $ARGV[$i+1], qq{">Next</a>]};
25 } else {
26 print OUT qq{[Next]};
27 }
28 print OUT qq{[<a href="faq.html">TOC</a>]};
29 print OUT qq{[<a href="http://www.mhonarc.org/">Home</a>]};
30 print OUT qq{\n</p>\n<!--X-NavButtons-End-->\n};
31 }
32 }
33
34 close IN;
35 close OUT;
36 unlink "$file.$$";
37}
38
39exit 0;