diff options
author | rsc <devnull@localhost> | 2005-01-14 21:01:19 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-01-14 21:01:19 +0000 |
commit | add3511e9bec8db231c645e6b44db8eb2b7ff315 (patch) | |
tree | 2c55d41d5acdd3ff78feae386a242a2b8e53587a /dist | |
parent | 0fdffa38a1a44f20dca78429ea96424d5eab07d2 (diff) | |
download | plan9port-add3511e9bec8db231c645e6b44db8eb2b7ff315.tar.gz plan9port-add3511e9bec8db231c645e6b44db8eb2b7ff315.tar.bz2 plan9port-add3511e9bec8db231c645e6b44db8eb2b7ff315.zip |
fixurls
Diffstat (limited to 'dist')
-rwxr-xr-x | dist/fixurls | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/dist/fixurls b/dist/fixurls new file mode 100755 index 00000000..c9beba82 --- /dev/null +++ b/dist/fixurls @@ -0,0 +1,34 @@ +#!/usr/bin/perl + +open(OMIT, "9 sed -n 's/.*Omitman\\[\"(.*)\\((.)\\)\".*/\\1 \\2/p' /usr/local/plan9/dist/checkman.awk |") || die "omit: $!"; +@omit = <OMIT>; +close OMIT; +chomp @omit; +# push @omit, "grep 1", "lseek 2", "tcs 1", "sed 1", "rc 1", "strcat 3", "yacc 1"; + +sub noref { + my ($p, $s) = @_; + + $text =~ s!<a href="../man$s/$p.html">(([^<]|<[^/]|</[^a])*)</a>!\1!g; +} + +for($i=0; $i<@ARGV; $i++){ + open(IN, $ARGV[$i]) || die "open $ARGV[$i]: $!"; + @text = <IN>; + close IN; + $text = join("", @text); + + foreach $o (@omit) { + $o =~ /(.*) (.*)/; + noref($1, $2); + } + + $text =~ s!../man(.)/([^.]*)\.html!$2$1.html!g; + $text =~ s!(http://swtch.com/plan9port/unix)!<a href="\1">\1</a>!g; + + open(OUT, ">$ARGV[$i]") || die "open $ARGV[$i]: $!"; + print OUT $text; + close OUT; +} + +exit 0; |