#!/usr/local/bin/perl -w # Copyright 1998 by John Halleck # All rights reserved require 5.0; use strict; use lib qw(/home/nahaj/lib); use configdirsvshtml qw( &userhtmlhome &userandpathfromhtmldir &userhtmldir &directoryfromurl &urlfromdirectory $thissite ); use treewalk qw(&doit &bustname $nodirmessage $needspace); use configdirsvshtml qw($runcgiwrap &homehtmldir); my $progversion = "Printdir version 1.21 29 June 1999"; # Print the contents of files in a directory. sub init { # Any global initialization. # print "DEBUG: Global initialization called\n"; return; } sub fini { # Any global termination code. # print "DEBUG: Global termination called\n"; return; } sub arginit { # Any per argument initialization my $argument = shift; # print "DEBUG: Argument initialization called with $given\n"; return; } sub argfini { # Any per argument termination code my $argument = shift; # print "DEBUG: Argument termination called\n"; return; } sub displayfile { # 0 to make this file invisible my $fullname = shift; my $inode = shift; # print "DEBUG: displayfile called with $fullname (inode: $inode)\n"; return 1; } sub wantdir { # Return 0 to force cull of tree here. my $fullname = shift; my $inode = shift; # print "DEBUG: wantdir called with $fullname (inode: $inode)\n"; return 1; } sub enterdirectory { my $indent = shift; my $fullname = shift; # print "DEBUG: directory initialization called with $fullname\n"; return; } sub exitdirectory { my $indent = shift; my $fullname = shift; # print "DEBUG: directory finalization called with $fullname\n"; return; } sub processfile { my $depth = shift; my $indent = shift; my $fullname = shift; my $line; my $wantit = 0; $needspace = 0; # print "$indent +DEBUG: processfile called with $fullname\n"; if (!-f $fullname) { return } if ($fullname =~ m/\.(ASC|I|COM|HT|HV|HTM|HTML|PERL|PL|PM|TXT|TEXT|PERL|README|SESSIONS|SETTINGS|C|H|FOR|F77|ADA|COBAL)$/i) { $wantit = 1; } elsif ($fullname =~ m/\.(DESCRIPTION|TITLE|SELFCONTAINED)$/i) { $wantit = 1; } elsif ($fullname =~ m/(^|\/)(REBUILD|MAKEFILE|README)$/i) { $wantit = 1; } if ($wantit) { if (!open (FILE, $fullname)) { print $indent, "*** Couldn't open file ($!)\a\n"; $needspace = 1; } else { while (defined ($line = )) { chomp $line; print $indent, $line, "\n"; } close (FILE) || print $indent, "*** Couldn't close file ($!)\a\n"; } $needspace = 1; } return; } sub processdir { my $indent = shift; my $fullname = shift; $needspace = 0; # print "$indent + DEBUG: processfile called with $fullname\n"; return; } sub processuseropt { # No options specific to this package. my $opt = shift; # print "DEBUG: Process user options called with $opt\n"; return 0; # return 1 if you processed the option. } sub printuseropt { # Ditto # print "DEBUG: printuseroption called\n"; return; } sub defaultfile { # what to do if the user specified nothing. # print "DEBUG: Default file called...\n"; if (defined $ENV{'PWD'}) { return $ENV{'PWD'} } if (defined $ENV{'HOME'}) { return $ENV{'HOME'} } return '.'; } sub mungename { my $given = shift; # print "DEBUG: processing file name $given\n"; return $given; } &doit ($progversion); exit 0;