#!/bin/perl # # GET /~wbc/tab-serv/tab-serv.cgi # # # the following few lines decide whether this is runnung on www or home # depending on the path to the location of the program # # use Cwd; # my $dir = getcwd; # ($a, $b) = split /\/wbc/, $dir , 2; # # $home = $a . "/wbc/"; # $home = "/net/syno-fs/wbc"; my $www = 0; my $home = 0; my $raddr = $ENV{'REMOTE_ADDR'}; my $laddr = $ENV{"SERVER_ADDR"}; my $local = 0; if ($raddr =~ /^104\.219/) { $local = 1;} if ($laddr eq "129.170.226.126") { $www = 1; } elsif ($laddr eq "129.170.136.10") { $www = 1; } elsif ($laddr eq "129.170.213.101") { $home = 1; } $www = 1; if ($home) { $server = "home.cs.dartmouth.edu"; $home = "/net/syno-fs/wbc"; $user = "wbc"; $test = 1; } elsif ($www) { $server = "www.cs.dartmouth.edu"; $home = "/home/wbc"; $user = "d14708a"; $test = 0; } else { print "Content-type: text/html\n\n"; print "

Please connect to "; print "https://www.cs.dartmouth.edu/~wbc/tab-serv/tab-serv.cgi<\/a>

\n"; exit;} $source = "$home/public_html/TabSource"; print "Content-type: text/html\n\n"; print "Lute tablature tab-serv\n"; print "\n"; print "\n"; print "

Tablature in PDF and PostScript format

"; print "

by Wayne Cripps

"; print "

http://$server/~$user/tab-serv/tab-serv.cgi

"; # print "

Sorry - this is out of order today!

"; # exit; print "This is the list of files of lute music in tablature form."; print " You can download the music by simply clicking on the"; print " eps or pdf letters after the file name."; print " Clicking pdf file will download the file to your computer rather than displaying it."; print " If your web viewer can display and print PostScript"; print " or PDF files you can see and print these files."; print " You can use "; print " Adobe Acrobat to read pdf files."; print "The eps format will produce slightly higher quality prints of the tablature, "; print " and can be displayed and printed with Ghostview."; print " The names in bold type are folders which you can select to open.\n
"; print " Windows Users - if clicking \"midi\" doesn\'t work try right clicking, selecting \"Save target as...\" and opening the file you have downloaded with windows media player.\n"; print ""; print ""; print ""; print ""; print ""; print ""; if ($test) { print ""; } # print "\n"; # print "\n"; print "
How do I print this music? What program typeset this music?
"; print "How do I read this stuff?"; print " the Lute Page"; print "    "; print "Tablature page
The test option uses the development version of tab.
program $0 $raddr $a
remote $raddr local $laddr

"; if ($ARGV[0]) { # this is for second level - a file or directory name is specified $name = $ARGV[0]; $lockret = stat("$source/$name/restricted"); # print "lock status $lockret\n"; open(GGG, "ls -1 $source/$name |"); print "

This folder is \"$name\"

\n"; print "\n"; while ( ) { $name2 = chop ($_); if (index($_, ".tab") > 0) { $sname = substr($_, 0, index($_, ".tab")); @statret = stat("$source/$name/$sname.tab"); $mytime = localtime($statret[9]); print "\n"; print "\n"; } elsif (index($_, ".txt") > 0) { $sname = $_; print "\n"; } else { #any other file # print "
  • $_ \n"; } } print "
  • ${sname}"; if ($local) { print " eps or";} if ($www ||$home) {print " pdf\n";} if ($test) { print " or pdf file download\n"; } if ( ! $lockret) { if ( 1 ) { print " or midi\n"; } if ( 1 ) { print " or tab source\n"; } } if ($test) { print " or test\n"; } print "   $mytime
    $name/${sname}"; print " text\n"; } elsif (index($_, ".pdf") > 0) { #do nothing for pdf ; } elsif ( isdir( "$source/$name/$_" ) ) { $sname = $_; # print "
  • $source/$name/$_\n"; print "
  • $sname open folder
    \n"; # print "

    login is $< $> $$"; print "

    Please contact me about any corrections you may wish to make"; print "

    Back to Tablature page
    \n"; } else { # top level, no argument or filename supplied open ( FFF, "ls -1 $source/ |") || die "
    File list open error
    /n"; while ( ) { $name = $_; chop $name; if (index($name, ".tab") > 0) { $sname = substr($_, 0, index($_, ".tab")); print "

  • ${sname} eps"; print " or pdf\n"; print " or midi
  • \n"; } elsif (index($_, ".txt") > 0) { $sname = $_; print "
  • $sname text\n"; } elsif (index($_, ".pdf") > 0) { $sname = $_; # don't do anything for pdf files at top level } else { print "
  • $name open folder\n"; } } } print "\n"; print "\n"; sub isdir { my $name = $_[0]; chomp $name; @vals = stat $name; $vals[2] & 0040000; }