tr_blck -- check for broken relative links in html pages
tr_blck [-AhW] [-d docroot] [-r regexp] html-files
tr_blck searches html files for broken links. I searches only the relative links and does not need a web-server. As it does not need web-access it is very fast. The output of tr_blck is of the same format as gcc error messages and can therefore be interpreted by many common editors (e.g emacs or vim). After editing a some html pages you can just type: tr_blck page1.html ../somewhere/page2.html and tr_blck will check that the links in these pages are correct.
tr_blck checks the relative filesystem links. These are links of the form: href="index.html" href="../somepage.html#anchor1" etc...
All tags containg relative links with href=..., src=..., and background=... are checked.
-h short help message
-a print all links that were not checked (proto://) and do not check for any broken links. This output can be processed further with httpcheck.
-A do not open any other files than the files given on the
-d document root directory to check abs. filesystem links e.g -d /home/httpd/html
-r warn about absolut links matching the given perl regexp E.g: -w \'www.linuxfocus.org|chem.pitt.edu\' This match is not case sensitive and only applied to links starting with proto:// (=absolut links).
-W do not print warnings about html errors (not terminated tags etc ...).
Check links in html files in the web server root directory (/home/httpd/html) and in all directories one level down: (cd /home/httpd/html; tr_blck *.html */*.html)
Check links in all html files on the server: (cd /home/httpd/html; tr_blck `find . -name '*.htm*' -print` | sort)
You can use the vim editor Quickfix mode or the emacs/xemacs M-x compile to parse the output of tr_blck. Vim: :cf file_with_err_messages, :cn to go to the next message emacs: M-x compile, compile command: cat file_with_err_messages
This gives you the possibility to open the concerned web page and jump directly to the line where the broken link is. To do this you can write a Makefile that looks e.g as follows:
all: tr_blck `find . -name '*.htm*' -print` | sort
tr_blck is part of the HTML::TagReader package and was written by Guido Socher [guido(at)linuxfocus.org]