#!/usr/bin/perl5 # linuxman2html by John Gotts . # Copyright 1996, John Gotts. # I hereby release this program under the GNU General Public License. Don't # sue me for it. if ($#ARGV < 0) { print "Usage: $0 [-v] [ ...]\n\n"; exit; } $working_directory = $ENV{"PWD"}; foreach $directory (@ARGV) { chdir $working_directory || die "Unable to change to working directory.\n"; if (! -d $directory) { print STDERR "$directory is not a directory; skipped.\n"; next; } if (! -r $directory) { printf STDERR "$directory is unreadable; skipped.\n"; next; } opendir (DIRECTORY, $directory); @files = readdir (DIRECTORY); chdir "$directory" || die "Unable to change to directory.\n"; foreach $file (@files) { if (-T $file) { if (! open(FILE, $file)) { print STDERR "Cannot open $file.\n"; next; } else { while () { if ($_ =~ /\.so (.*)/) { @target = split (/\//, $1); system ("ln -sf @target[1].html $file.html\n"); } else { system ("nroff -man $file | man2html > $file.html\n"); } seek (FILE, 0, 2); } close (FILE); } } } closedir (DIRECTORY); print "Done with $directory.\n"; }