home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
- #
- # catwhatis -- cat out the whatis database(s)
-
- for $manroot (split(/:/, shift || $ENV{'MANPATH'} || '/usr/man')) {
- if (!dbmopen(manroot, "$manroot/whatis", undef)) {
- warn "Can't dbmopen $manroot/whatis: $!\n";
- next;
- }
- print "$manroot:\n";
- while (($key,$value) = each %manroot) {
- for (split(/\002/, $value)) {
- if (/\001/) {
- ($cmd, $page, $section, $desc) = split(/\001/);
- printf "%-30s - %s\n", "$cmd ($section)", $desc;
- } else {
- printf "%-30s > %s\n", $key, $_;
- }
- }
- }
- dbmclose(manroot);
- }
-