#!/usr/bin/perl -w #Generate page of abstracts based on contents of files # Modified May 14, 2012. Replaced \1 and \2 with $1 and $2 # respectively in s// statements. rcg # R. Groman March 17, 1997 #Assumptions # top level of directory tree is 1st arg in query string # directory to be looked at is 2nd arg in query string # Query string arg. are separated by & # Expects start of html files to at ../htdocs/.. print "Content-type: text/html\n\n"; if ($ENV{'QUERY_STRING'}) { $arg = ( $ENV{'QUERY_STRING'} ); } else { die "Could not access query string with directory information"; } $topdir="$arg"; $topdir=~ s/(.*)&.*/$1/; $subdirectory="$arg"; $subdirectory=~ s/(.*)&(.*)/$2/; ##print "\ndebug: topdir=$topdir\n\t subdirectory=$subdirectory\n"; $dir="$topdir" . "$subdirectory"; $htdocs="$dir"; $htdocs=~s/(.*)htdocs(.*)/$2/; ##print "\ndebug: htdocs=$htdocs\n"; chdir($dir) || die "Cannot change to $dir directory"; $topic="$subdirectory"; $topic=~ s/(.*)s/$1/; print "U.S. GLOBEC Geoges Bank: Summary of \u$topic Abstracts\n"; print "

U.S. GLOBEC Geoges Bank: Summary of "; print "\u$topic Abstracts

\n\n"; #Read each abstract, extract out information, and create link. while ($filename = <*.html>) { # print "\ndebug: filename=$filename\n"; open(ABSTRACT,"$filename") || die "Could not open file = $filename"; while () { chop; if ( /.*

//i; $href= "$htdocs" . "/" . "$filename"; $reference= "\u$filename"; $reference=~ s/(.*)\d+/$1/; $reference=~ s/(.*).html/$1/; print "

${reference}...: "; print "$_\n"; while () { chop; if ( ! m!(.*)

!i ) { s!(.*)(.*)!$1 $2!i; s!(.*)(.*)!$1 $2!i; print "$_\n"; ## print "\ndebug at aa: line=$_\n"; } else { s!(.*)(.*)!$1 $2!i; s!(.*)(.*)!$1 $2!i; print "$_\n"; ## print "\ndebug at bb: line=$_\n"; last ; } print ""; #should not get here, but cover oneself } last ; } } } print "\n\n\n";