From 6bf41292c1807437ec7472f7957227f6736109b0 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 8 Jun 2012 14:01:09 -0400 Subject: Why are we still carrying the old perl scripts around? --- perl-v2/BibTeX.pm | 303 ----------------------------------------------- perl-v2/PDOSBib.pm | 233 ------------------------------------ perl-v2/PDOSCGI.pm | 69 ----------- perl-v2/bibtex-entry.cgi | 206 -------------------------------- perl-v2/mkpdospubs.pl | 242 ------------------------------------- perl-v2/pubs-date.cgi | 288 -------------------------------------------- 6 files changed, 1341 deletions(-) delete mode 100644 perl-v2/BibTeX.pm delete mode 100644 perl-v2/PDOSBib.pm delete mode 100644 perl-v2/PDOSCGI.pm delete mode 100644 perl-v2/bibtex-entry.cgi delete mode 100644 perl-v2/mkpdospubs.pl delete mode 100644 perl-v2/pubs-date.cgi (limited to 'perl-v2') diff --git a/perl-v2/BibTeX.pm b/perl-v2/BibTeX.pm deleted file mode 100644 index 17bc392..0000000 --- a/perl-v2/BibTeX.pm +++ /dev/null @@ -1,303 +0,0 @@ -package BibTeX; -use Symbol 'qualify_to_ref'; - -%bibtex_prototypes = ('string' => 'p', 'preamble' => 'v', '_' => 'kp*'); - -sub parse_bibtex_key ($) { - my($fh) = @_; - $_ = <$fh> while ((/^\s+$/s || /^\s+%/) && !eof $fh); - if (/^\s*([^"#%'(),={}\s]+)(.*)/s) { - $_ = $2; - lc($1); - } else { - print STDERR "no key at line $.\n"; - ""; - } -} - -sub parse_bibtex_value ($$) { - my($fh, $strings) = @_; - my($data) = ""; - my($bracelevel, $line); - - # loop over concatenation - while (1) { - - # loop over lines - $_ = <$fh> while ((/^\s+$/s || /^\s+%/) && !eof $fh); - s/^\s+//; - if (eof $fh) { - print STDERR "unexpected end of file\n"; - return $data; - } - - # check type of thing - if (/^\"(.*)/s) { - $_ = $1; - $bracelevel = 0; - $line = $.; - while (1) { - if (!$bracelevel && /^([^{}\"]*)\"(.*)/s) { - $data .= $1; - $_ = $2; - last; - } elsif ($bracelevel && /^([^{}]*\})(.*)/s) { - $data .= $1; - $_ = $2; - $bracelevel--; - } elsif (/^([^{}]*\{)(.*)/s) { - $data .= $1; - $_ = $2; - $bracelevel++; - } else { - $data .= $_; - die "end of file within quotes started at line $line" if eof $fh; - $_ = <$fh>; - } - } - - } elsif (/^\{(.*)/s) { - $_ = $1; - $bracelevel = 1; - $line = $.; - while ($bracelevel) { - if (/^([^{}]*)\}(.*)/s) { - $data .= $1; - $data .= "}" if $bracelevel > 1; - $_ = $2; - $bracelevel--; - } elsif (/^([^{}]*\{)(.*)/s) { - $data .= $1; - $_ = $2; - $bracelevel++; - } else { - $data .= $_; - die "end of file within braces started at line $line" if eof $fh; - $_ = <$fh>; - } - } - - } elsif (/^\#/) { - # do nothing - print STDERR "warning: odd concatenation at line $.\n"; - } elsif (/^[\},]/) { - print STDERR "no data after field at line $.\n" if $data eq ''; - return $data; - } elsif (/^([^\s\},]+)(.*)/s) { - if ($strings->{lc($1)}) { - $data .= $strings->{lc($1)}; - } else { - $data .= $1; - } - $_ = $2; - } - - # got a single string, check for concatenation - $_ = <$fh> while ((/^\s+$/s || /^\s+%/) && !eof $fh); - s/^\s+//; - if (/^\#(.*)/s) { - $_ = $1; - } else { - return $data; - } - } -} - -sub parse_bibtex_entry ($$$$) { - # uses caller's $_ - my($fh, $name, $strings, $entries) = @_; - my($entryline) = $.; - - $_ = <$fh> while /^\s+$/ && !eof $fh; - if (/^\s*\{(.*)/s) { - $_ = $1; - } else { - print STDERR "no open brace after \@$name starting at line $entryline\n"; - return []; - } - - # get prototype - my($prototype) = $bibtex_prototypes{$name}; - $prototype = $bibtex_prototypes{'_'} if !defined $prototype; - - # parse entry into `@v' - my(@v, $a, $b); - while (!eof $fh) { - $_ = <$fh> while /^\s*$/ && !eof $fh; - if (/^\s*\}(.*)/s) { - $_ = $1; - last; - } elsif ($prototype =~ /^k/) { - push @v, parse_bibtex_key($fh); - } elsif ($prototype =~ /^v/) { - push @v, parse_bibtex_value($fh, $strings); - } elsif ($prototype =~ /^p/) { - push @v, parse_bibtex_key($fh); - $_ = <$fh> while /^\s+$/ && !eof $fh; - s/^\s+\=?//; - push @v, parse_bibtex_value($fh, $strings); - } - $_ = <$fh> while /^\s*$/ && !eof $fh; - s/^\s*,?//; - $prototype = substr($prototype, 1) - if $prototype && $prototype !~ /^.\*/; - } - print STDERR "missing args to \@$name at line $.\n" - if $prototype && $prototype !~ /^.\*/; - - # do something with entry - if ($name eq 'string') { - $strings->{$v[0]} = $v[1]; - } elsif ($name eq 'preamble') { - # do nothing - } else { - my($key) = shift @v; - $entries->{$key} = {@v}; - $entries->{$key}->{'_type'} = $name; - $entries->{$key}->{'_key'} = $key; - push @{$entries->{'_'}}, $key; - } -} - -sub parse (*;\%) { - my($fh) = qualify_to_ref(shift, caller); - my($initial_strings) = @_; - my($strings) = $initial_strings; - - my($curname, $garbage, %entries); - local($_) = ''; - while (<$fh>) { - - if (/^\s*[%\#]/ || /^\s*$/) { - # comment - - } elsif (/^\s*\@([^\s\"\#%\'(),={}]+)(.*)/s) { - $curname = lc($1); - $_ = $2; - parse_bibtex_entry($fh, $curname, $strings, \%entries); - - } else { - print STDERR "garbage at line $.\n" if !defined $garbage; - $garbage = 1; - } - } - - \%entries; -} - -sub expand ($$) { - my($e, $key) = @_; - my(%d) = %{$e->{$key}}; - while ($d{'crossref'}) { - my($v) = $d{'crossref'}; - delete $d{'crossref'}; - %d = (%{$e->{$v}}, %d); - } - \%d; -} - - -sub split_von ($$$@) { - my($f, $v, $l, @x) = @_; - my(@pre, $t, $in_von, $tt); - while (@x) { - $t = $tt = shift @x; - if ($tt =~ /^\{\\/) { - $tt =~ s/\\[A-Za-z@]+//g; - $tt =~ s/\\.//g; - $tt =~ tr/{}//d; - } - if ($tt =~ /^[a-z]/) { - push @$v, $t; - $in_von = 1; - } elsif ($in_von || !ref($f)) { - push @$l, $t, @x; - return; - } else { - push @$f, $t; - } - } - if (!$in_von) { - push @$l, (pop @$f); - } -} - -sub parse_author ($) { - local($_) = $_[0]; - my(@x) = (); - my($pos, $pos0, $t, $bracelevel); - - $bracelevel = 0; - - # move text into @x - while (!/^\s*$/) { - s/^\s+//; - $pos = 0; - while ($pos < length) { - $t = substr($_, $pos, 1); - if ($t eq '{') { - $bracelevel++; - } elsif ($t eq '}') { - $bracelevel--; - } elsif ($bracelevel <= 0) { - last if ($t =~ /[\s,]/); - } - $pos++; - } - - push @x, substr($_, 0, $pos); - if ($t eq ',') { - push @x, ','; - $pos++; - } - $_ = substr($_, $pos); - } - - # split @x into arrays based on `and' - my(@aa) = ([]); - foreach $t (@x) { - if ($t eq 'and') { - push @aa, [] if @{$aa[-1]} > 0; - } else { - push @{$aa[-1]}, $t; - } - } - - # massage each subarray into four parts: first, von, last, jr - my(@aaa) = (); - foreach $t (@aa) { - my(@fvl, @vl, @v, @l, @f, @j, $cur, $commas); - $cur = \@fvl; $commas = 0; - - # split into subarrays if possible - foreach $x (@$t) { - if ($x eq ',') { - if ($commas == 0) { - @vl = @fvl; - @fvl = (); - $cur = \@f; - } else { - push @j, @f; - @f = (); - } - $commas++; - } else { - push @$cur, $x; - } - } - - # split out the `von' part - if ($commas == 0) { - split_von(\@f, \@v, \@l, @fvl); - } else { - split_von(0, \@v, \@l, @vl); - } - - # store as an array of arrays - push @aaa, [[@f], [@v], [@l], [@j]]; - } - - @aaa; -} - -1; diff --git a/perl-v2/PDOSBib.pm b/perl-v2/PDOSBib.pm deleted file mode 100644 index 013cfbe..0000000 --- a/perl-v2/PDOSBib.pm +++ /dev/null @@ -1,233 +0,0 @@ -package main; - -# maps regexps, which are applied to authors, to their home page URLs -@author_urls = - ( - 'Berthold' => 'http://page.inf.fu-berlin.de/~berthold/', - 'Chaum' => 'http://www.chaum.org', - 'Dingledine' => 'http://www.freehaven.net/~arma/cv.html', - 'Desmedt' => 'http://www.cs.fsu.edu/~desmedt/', - 'Jakobsson' => 'http://www.cs.ucsd.edu/users/markus/', - 'K.*Kurosawa' => 'http://kuro.cis.ibaraki.ac.jp/~kurosawa/', - 'Mathewson' => 'http://www.wangafu.net/~nickm/', - 'Mazières' => 'http://www.scs.cs.nyu.edu/~dm/', - 'A.*Pfitzmann' => 'http://dud.inf.tu-dresden.de/~pfitza/', - 'B.*Pfitzmann' => 'http://www.zurich.ibm.com/~bpf/', - 'Rivest' => 'http://theory.lcs.mit.edu/~rivest/', - 'Serjantov' => 'http://www.cl.cam.ac.uk/users/aas23/', - 'Syverson' => 'http://www.syverson.org/', - 'David.*Wagner' => 'http://www.cs.berkeley.edu/~daw/', - 'Shoup' => 'http://www.shoup.net/', - 'B.*Möller' => 'http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller.html', - - -# From the old PDOS file... - 'Engler' => 'http://www.pdos.lcs.mit.edu/~engler/', - 'Kaashoek' => 'http://www.pdos.lcs.mit.edu/~kaashoek/', - 'Blake' => 'http://www.pdos.lcs.mit.edu/cb/', - - 'Ganger' => 'http://www.ece.cmu.edu/~ganger/', - 'Grimm' => 'http://www.cs.washington.edu/homes/rgrimm/', - 'Hsieh' => 'http://www2.cs.utah.edu/~wilson/', - 'Briceño' => 'http://mit.edu/hbriceno/www/', - 'Wallach' => 'http://www.pdos.lcs.mit.edu/~kerr/', - 'Candea' => 'http://www.cs.stanford.edu/~candea/', - 'Kohler' => 'http://www.pdos.lcs.mit.edu/~eddietwo/', - 'Kirk.*Johnson' => 'http://www.cs.colorado.edu/~tuna/', - 'Weihl' => 'http://www.research.digital.com/SRC/staff/weihl/', - 'Nygren' => 'http://www.mit.edu/people/nygren/', - 'Anthony.*Joseph' => 'http://www.cs.berkeley.edu/~adj/', - 'Poletto' => 'http://www.pdos.lcs.mit.edu/~maxp/', - 'Kaminsky' => 'http://www.pdos.lcs.mit.edu/~kaminsky/', - 'Morris' => 'http://www.pdos.lcs.mit.edu/~rtm/', - 'Jannotti' => 'http://www.jannotti.com/', - 'Benjie' => 'http://www.pdos.lcs.mit.edu/~benjie/', - 'Jinyang' => 'http://www.pdos.lcs.mit.edu/~jinyang/', - 'Douglas.*outo' => 'http://www.pdos.lcs.mit.edu/~decouto/', - 'Kevin.*Fu' => 'http://snafu.fooworld.org/~fubob/', - 'Karger' => 'http://theory.lcs.mit.edu/~karger/', - 'Dabek' => 'http://pdos.lcs.mit.edu/~fdabek/', - 'Brunskill' => 'http://pdos.lcs.mit.edu/~emma/', - 'Balakrishnan' => 'http://nms.lcs.mit.edu/~hari/', - 'Stoica' => 'http://www.cs.berkeley.edu/~istoica/', - 'Andersen' => 'http://nms.lcs.mit.edu/~dga/', - 'Snoeren' => 'http://nms.lcs.mit.edu/~snoeren/', - 'Freedman' => 'http://www.pdos.lcs.mit.edu/~mfreed/', - 'Emil.*Sit' => 'http://www.mit.edu/~sit/', - 'Nick.*Feamster' => 'http://nms.lcs.mit.edu/~feamster/', - ); - -# don't print entries for these types, which are only used for crossreferences -%dont_print = - ('proceedings' => 1, 'journal' => 1); - -%initial_strings = - ('jan' => 'January', 'feb' => 'February', - 'mar' => 'March', 'apr' => 'April', - 'may' => 'May', 'jun' => 'June', - 'jul' => 'July', 'aug' => 'August', - 'sep' => 'September', 'oct' => 'October', - 'nov' => 'November', 'dec' => 'December'); - - -sub dont_print ($) { - my($d) = @_; - $dont_print{$d->{'_type'}} || - ($d->{'www_show'} && ($d->{'www_show'} eq 'no')); -} - -sub htmlize ($) { - my($x) = @_; - $x =~ s/&([^a-z0-9])/&$1/g; - $x =~ s/\\i([^a-zA-Z@])/i$1/g; - $x =~ s/\\'(.)/&$1acute;/g; - $x =~ s/\\`(.)/&$1grave;/g; - $x =~ s/\\~(.)/&$1tilde;/g; - $x =~ s/\\\^(.)/&$1circ;/g; - $x =~ s/\\"(.)/&$1uml;/g; - $x =~ s/\\[a-zA-Z@]+//g; - $x =~ s/\\.//g; - $x =~ tr/{}//d; - $x =~ s/(\d)--(\d)/$1-$2/g; - $x; -} - -sub htmlize_author ($) { - my($aaa) = @_; - my($x) = join(' ', @{$aaa->[0]}, @{$aaa->[1]}, @{$aaa->[2]}); - if (@{$aaa->[3]}) { - $x .= ', ' . join(' ', @{$aaa->[3]}); - } - htmlize($x); -} - -sub push_availability ($$\@$) { - my($d, $key, $availability, $name) = @_; - if ($d->{$key}) { - my($url) = $d->{$key}; - $url = $server_url . $url if $url =~ /^\//; - push @$availability, '' . $name . ''; - } -} - -sub htmlize_biblio_info ($) { - my($d) = @_; - my($_type) = $d->{'_type'}; - my($x, $i); - - if ($_type eq 'inproceedings') { - $x = "In the " . $d->{'booktitle'}; - if ($d->{'bookurl'}) { - if ($x =~ /^(in the proceedings of( the)? )(.*)/i - || $x =~ /^(in the workshop record of( the)? )(.*)/i) { - $x = $1 . "{'bookurl'}\">" . $3 . ""; - } else { - $x = "In the {'bookurl'}\">$d->{'booktitle'}"; - } - } - $x .= ", " . $d->{'edition'} if $d->{'edition'}; - $x .= ", " . $d->{'address'} if $d->{'address'}; - $x .= ", " . ($d->{'month'} or "") . " " . ($d->{'year'} or "") - if $d->{'month'} || $d->{'year'}; - $x .= ($d->{'pages'} =~ /^\d+$/ ? ", page " : ", pages ") - . $d->{'pages'} if $d->{'pages'}; - - } elsif ($_type eq 'article') { - $x = "In " . $d->{'journal'}; - if ($d->{'journalurl'}) { - $x =~ s/^(in )(.*)$/$1$2<\/a>/; - } - $x .= " " . $d->{'volume'} . "" if $d->{'volume'}; - $x .= "(" . $d->{'number'} . ")" if $d->{'number'}; - $x .= ", " . ($d->{'month'} or "") . " " . ($d->{'year'} or "") - if $d->{'month'} || $d->{'year'}; - $x .= ($d->{'pages'} =~ /^\d+$/ ? ", page " : ", pages ") - . $d->{'pages'} if $d->{'pages'}; - - } elsif ($_type eq 'techreport') { - $x = $d->{'institution'}; - $x .= " " . ($d->{'type'} ? $d->{'type'} : "technical report"); - $x .= " " . $d->{'number'}; - $x .= ", " . $d->{'month'} . " " . $d->{'year'} - if $d->{'month'} || $d->{'year'}; - - } elsif ($_type eq 'mastersthesis' || $_type eq 'phdthesis') { - $x = ($_type eq 'mastersthesis' ? "Master's thesis" : "Ph.D. thesis"); - $x = $d->{'type'} if $d->{'type'}; - $x .= ", " . $d->{'school'} if $d->{'school'}; - $x .= ", " . $d->{'month'} . " " . $d->{'year'} - if $d->{'month'} || $d->{'year'}; - - } elsif ($_type eq 'misc') { - $x = $d->{'howpublished'}; - $x .= ", " . $d->{'month'} . " " . $d->{'year'} - if $d->{'month'} || $d->{'year'}; - $x .= ($d->{'pages'} =~ /^\d+$/ ? ", page " : ", pages ") - . $d->{'pages'} if $d->{'pages'}; - - } else { - $x = "<odd type $_type>"; - } - - $x = '' . ($x or "") . ". "; - $x .= "({'_key'} . "\">BibTeX entry)"; - htmlize($x); -} - -sub htmlize_entry ($) { - my($d) = @_; - my(@availability, @a, $a, $i, $j, $x); - - # print title - $x .= '
  • ' . htmlize($d->{'title'}) . "."; - - # print availability - @availability = (); - push_availability $d, 'www_abstract_url', @availability, 'abstract'; - push_availability $d, 'www_html_url', @availability, 'HTML'; - push_availability $d, 'www_txt_url', @availability, 'TXT'; - push_availability $d, 'www_pdf_url', @availability, 'PDF'; - push_availability $d, 'www_ps_url', @availability, 'PS'; - push_availability $d, 'www_ps_gz_url', @availability, 'gzipped PS'; - if (@availability) { - $x .= ' ('; - $x .= join(', ', @availability) . ")"; - } - $x .= "
    \n"; - - # print authors - $x .= 'by '; - @a = BibTeX::parse_author($d->{'author'}); - foreach $i (0..$#a) { - $x .= ", " if ($i > 0 && $i < $#a); - $x .= " and " if ($i == $#a && $#a == 1); - $x .= ", and " if ($i == $#a && $#a > 1); - $a = htmlize_author($a[$i]); - for ($j = 0; $j < @author_urls; $j += 2) { - if ($a =~ /$author_urls[$j]/) { - $x .= '' . $a . ''; - undef $a; - last; - } - } - $x .= $a if defined $a; - } - $x .= "." if (defined $a and $a !~ /\.$/); - $x .= "
    \n"; - - $x .= htmlize_biblio_info($d); - $x .= "

  • \n\n"; - - $x; -} - - -sub url_untranslate ($) { - my($x) = $_[0]; - $x =~ s/ /+/g; - $x =~ s/([%<>])/sprintf("%02x", chr($1))/eg; - $x; -} - -1; diff --git a/perl-v2/PDOSCGI.pm b/perl-v2/PDOSCGI.pm deleted file mode 100644 index bb081bb..0000000 --- a/perl-v2/PDOSCGI.pm +++ /dev/null @@ -1,69 +0,0 @@ -package main; - -##### -# SERVER DATA - -$server_url = "http://www.pdos.lcs.mit.edu"; -$img_dir = "/img"; -$cgi_dir = "/cgi-bin"; -$main_dir = ""; # == top dir -$css_dir = ""; # == top dir -#$pdos_bib_dir = "/home/am0/httpd/htdocs/pdosbib"; -$pdos_bib_dir = "."; - - -##### -# ERROR_EXIT -# &error_exit($title, $message...) prints an HTML document summarizing the -# error and exits. - -sub error_exit ($@) { - my($title) = $_[0]; - my($message) = join('', @_[1..$#_]); - print <<"EOD;"; -Content-type: text/html - - -PDOS CGI Error - - -

    $title

    - -

    $message - -

    PDOS home page - - - -EOD; - exit 0; -} - -##### -# HTTP_DATE -# Given a time value (seconds since 00:00:00 UTC, Jan 1, 1970), formats an -# HTTP date and returns it. Useful for Expires:. - -@PDOSCGI::weekdays = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); -@PDOSCGI::months = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', - 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); - -sub http_date ($) { - my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = - gmtime($_[0]); - sprintf("%s, %02d %s %d %02d:%02d:%02d GMT", - $PDOSCGI::weekdays[$wday], $mday, $PDOSCGI::months[$mon], - $year, $hour, $min, $sec); -} - -##### -# URL_TRANSLATE - -sub url_translate ($) { - my($x) = $_[0]; - $x =~ s/\+/ /g; - $x =~ s/%(\w\w)/pack('C', hex($1))/eg; - $x; -} - -1; diff --git a/perl-v2/bibtex-entry.cgi b/perl-v2/bibtex-entry.cgi deleted file mode 100644 index 8c166fa..0000000 --- a/perl-v2/bibtex-entry.cgi +++ /dev/null @@ -1,206 +0,0 @@ -#!/usr/bin/perl -# CGI script: PDOS publication BibTeX entry -# Eddie Kohler, June 10, 1999 - -use lib '/home/am3/httpd/htdocs/pdosbib'; -#use lib '/u/eddietwo/www/pdos/pdosbib'; -use BibTeX; -use PDOSCGI; - -%initial_strings = - ('jan' => 'January', 'feb' => 'February', - 'mar' => 'March', 'apr' => 'April', - 'may' => 'May', 'jun' => 'June', - 'jul' => 'July', 'aug' => 'August', - 'sep' => 'September', 'oct' => 'October', - 'nov' => 'November', 'dec' => 'December'); - -open(BIB, "$pdos_bib_dir/pdos.bib") - || error_exit("Can't open pdos.bib!"); -$e = BibTeX::parse(*BIB, %initial_strings); -close BIB; - -##### -# PROCESS_QUERY - -sub process_query ($) { - my($q) = $_[0]; - while ($q =~ /^\&?([^\&]+)(.*)/) { - $_ = url_translate($1); - $q = $2; - if (/^key=(.*)$/) { - $bibtex_key = $1; - } else { - error_exit('Bad Query', <<"EOD;"); -I don't understand part of your query -- specifically, the ``$_'' -part. -EOD; - } - } -} - - -## -# INITIALIZATION & READING - -$index_url = "http://$ENV{'SERVER_NAME'}$ENV{'REQUEST_URI'}"; -$index_url =~ s#/[^/]+$#/#; - -&process_query($ENV{'QUERY_STRING'}) if exists $ENV{'QUERY_STRING'}; - -print <<"EOD;"; -Content-type: text/html - - - - - - - - -PDOS Publications Search Results - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -




      MIT > LCS > PDOS Home > 

    Publications > 

    BibTeX entry


    -Projects
    -People
    -Software

    -By subject
    -By date
    -

     Publication -search:  
    - - - - - - - - - - - - - - - - -

    - -EOD; - -$type = ($bibtex_key ? "`$bibtex_key'" : "all entries"); -print "

    BibTeX entry server: results for $type

    \n"; - -sub break_lines ($$) { - my($t, $l) = @_; - my($s, $f, $p, $x) = (0, 0, 0, ""); - while ($p < length $t) { - if (substr($t, $p, 1) =~ /\s/) { - $s = $p; - } elsif ($f + $l <= $p && $s > $f) { - $x .= substr($t, $f, $s - $f) . "\n"; - $s = $f = $s + 1; - } - $p++; - } - $x .= substr($t, $f); - $x; -} - -if ($bibtex_key && $e->{$bibtex_key}) { - $d = BibTeX::expand($e, $bibtex_key); - $k = "\@" . $d->{'_type'} . "{" . $bibtex_key . ",\n"; - foreach $i ('title', 'author', 'journal', 'booktitle', 'school', 'institution', 'organization', 'volume', 'number', 'year', 'month', 'address', 'chapter', 'edition', 'pages', 'editor', 'howpublished', 'key', 'publisher', 'type', 'note') { - if (exists $d->{$i}) { - $k .= break_lines(" " . $i . " = {" . $d->{$i} . "},\n", 80); - } - } - $k .= "}\n"; -} elsif ($bibtex_key) { - print "

    There is no PDOS paper with key `$bibtex_key'.\n"; - undef $k; -} else { - $k = `cat pdos.bib`; -} -if (defined $k) { - $k =~ s/&/&/g; - $k =~ s//>/g; - print "

    $k
    \n"; -} - - -print <<"EOD;"; -

    - - - -EOD; diff --git a/perl-v2/mkpdospubs.pl b/perl-v2/mkpdospubs.pl deleted file mode 100644 index 777386a..0000000 --- a/perl-v2/mkpdospubs.pl +++ /dev/null @@ -1,242 +0,0 @@ -#!/usr/local/bin/perl -w -# *** -# *** CGI script: static PDOS publication list -# *** Eddie Kohler, June 10, 1999 -# *** -# *** Take a look at PDOSBib.pm -# *** to change things like people's URLs -# *** and how different bibliography entries are generated -# *** -# *** Take a look at PDOSCGI.pm -# *** to change where files are located -# *** - -#use lib '/home/am0/httpd/htdocs/pdosbib'; -use BibTeX; -use PDOSBib; -use PDOSCGI; - -sub do_entries () { - my($section, $key, $d); - foreach $section (@sections) { - # print section header - print '

    '; - print $section, "

    \n"; - print "\n"; - } -} - - -sub do_sections () { - foreach $section (@sections) { - print '

    ', $section, "

    \n"; - } -} - - -# main program -if (@ARGV > 0) { - open(BIB, $ARGV[0]) || die "can't open $ARGV[0]"; -} else { - open(BIB, "<&STDIN"); -} -$e = BibTeX::parse(*BIB, %initial_strings); -close BIB; - -if (@ARGV > 1) { - open(STDOUT, ">$ARGV[1]") || die "can't open $ARGV[1]"; -} - -# make sections -@sections = (); -foreach $key (@{$e->{'_'}}) { - next if dont_print($e->{$key}); - $section = $e->{$key}->{'www_section'}; - if (not $section) { - $e->{$key}->{'www_section'} = $section = "Miscellaneous"; - } - - if (!exists $sections{$section}) { - push @sections, $section if $section ne ''; - $sections{$section} = 1; - } -} -push @sections, 'Miscellaneous' - if $sections{''} && !$sections{'Miscellaneous'}; - -## PRINT STUFF! -$argv_string = join(' ', 'mkpdospubs.pl', @ARGV); -print <<"EOD;"; - - - - - - - -Anonymity Bibliography - - - - - - - - - - - -

    Anonymity bibliography

    -

    By subject | By date

    - -
    - - - - - - - - - - - - - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


    Publication search:
    -


    Subjects:
    -EOD; - -## PRINT SECTIONS -do_sections; - -print <<"EOD;"; -

    -
    - -

    Publications by subject

    - -EOD; - -## PRINT ENTRIES -do_entries; - -print <<"EOD;"; -

    - - - -EOD; diff --git a/perl-v2/pubs-date.cgi b/perl-v2/pubs-date.cgi deleted file mode 100644 index fe37b34..0000000 --- a/perl-v2/pubs-date.cgi +++ /dev/null @@ -1,288 +0,0 @@ -#!/usr/local/bin/perl -wT -# CGI script: PDOS publications by date -# Eddie Kohler, June 10, 1999 - -#use lib '.'; -#use lib '/home/am0/httpd/htdocs/pdosbib'; -#use lib '/u/eddietwo/www/pdos/pdosbib'; -use BibTeX; -use PDOSBib; -use PDOSCGI; - -%date_back = - ('January' => 1, 'February' => 2, - 'March' => 3, 'April' => 4, - 'May' => 5, 'June' => 6, - 'July' => 7, 'August' => 8, - 'September' => 9, 'October' => 10, - 'November' => 11, 'December' => 12); - -sub do_entries () { - my($key, $d, @x, @d, @date, @permute, $x, $y, $i, $ever); - my($current_year) = (gmtime())[5] + 1900; - - foreach $key (@{$e->{'_'}}) { - $d = BibTeX::expand($e, $key); - next if dont_print($d); - $x = $y = htmlize_entry $d; - if (defined $match) { - $y =~ s/&([\w])\w+;/$1/g; - $y =~ s/<.*?>//g; - next if !&matcher($y); - } - push @x, $x; - push @d, $d; - if ($d->{'year'} and $d->{'year'} =~ /to appear/i) { - push @date, 12*$current_year + 12; - $d->{'_show_year'} = $current_year; - } elsif ($d->{'year'}) { - push @date, 12*$d->{'year'} + $date_back{($d->{'month'} or "January")}; - $d->{'_show_year'} = ($d->{'year'} ? $d->{'year'} : 'unknown'); - } else { - push @date, 0; - $d->{'_show_year'} = "(No date)"; - } - push @permute, $#x; - } - - # permute the list, sort by date - @permute = reverse sort { $date[$a] <=> $date[$b] } @permute; - undef $y; - - # print entries - foreach $i (@permute) { - $d = $d[$i]; - if ($d->{'_show_year'} and $d->{'_show_year'} ne $y || !$ever) { - print "\n" if $ever; - $y = $d->{'_show_year'}; - $ever = 1; - print "

    $y

    \n\n" if $ever; - print "No matches.\n" if !$ever; -} - -##### -# PROCESS_QUERY - -sub process_query ($) { - my($q) = $_[0]; - while ($q =~ /^\&?([^\&]+)(.*)/) { - $_ = url_translate($1); - $q = $2; - if (/^match=(.*)$/) { - $match = $1; - $match =~ s/\///g; - # my name gets mangled a lot... decouto - $match =~ s/decouto/De Couto/i; - } else { - error_exit('Bad Query', <<"EOD;"); -I don't understand part of your query -- specifically, the ``$_'' -part. -EOD; - } - } -} - -## -# INITIALIZATION & READING - -$index_url = "http://$ENV{'SERVER_NAME'}$ENV{'REQUEST_URI'}"; -$index_url =~ s#/[^/]+$#/#; - -&process_query($ENV{'QUERY_STRING'}) if exists $ENV{'QUERY_STRING'}; - -## PRINT DATA - -$| = 1; -print <<"EOD;"; -Content-type: text/html - - - - - - - - -Anonymity Bibliography: Search Results - - - - - - - - - -

    Anonymity Bibliography

    - -

    By subject | - By date | - Search:  -
    -

    - - - - - - - - - - - - - - - - -

    - -EOD; - -if (defined($match)) { - print "

    Publications matching `$match'

    \n"; -} else { - print "

    Publications by date

    \n"; -} - -$| = 0; - -open(BIB, "$pdos_bib_dir/anonbib.bib") - || error_exit("Can't open $pdos_bib_dir/anonbib.bib!"); -$e = BibTeX::parse(*BIB, %initial_strings); -close BIB; - -# make sections -foreach $key (@{$e->{'_'}}) { - next if dont_print($e->{$key}); - $e->{$key}->{'www_section'} = "Miscellaneous" - if (not $e->{$key}->{'www_section'}); -} - -if (defined($match)) { - $sub = 'sub main::matcher ($) { 1'; - if ($match =~ /[\.\^\$\[\](){}*|]/) { - $sub .= " && \$_[0] =~ /$match/oi"; - } elsif ($match eq ':abstract:') { - $sub .= " && \$_[0] =~ /\\(abstract\\b/oi"; - } else { - $_ = $match; - s/\+//; - while ($_ ne '') { - s/^\s+//; - if (/^\"([^\"]+)(.*)/) { - $sub .= " && \$_[0] =~ /$1/oi"; - $_ = $2; - $_ =~ s/^\"//; - } elsif (/^\"\"(.*)/) { - $_ = $2; - } elsif (/^(\S+)(.*)/) { - $sub .= " && \$_[0] =~ /$1/oi"; - $_ = $2; - } - } - } - eval "$sub; }"; -} - -do_entries; - -print <<"EOD;"; -

    - - - -EOD; -- cgit v1.2.3-70-g09d2