#!/usr/bin/perl # Mathcad Project Calc III Spring 98 # Stefan Adams - Display tutorials CGI Script # Torbin Pace - Tutorial # Justin Siess - .mcd Filetype Set # Comments: # Drop the .mcd or .ma file into any directory under ecmail.ecc.cc.mo.us/~pre_eng/tutorials # Edit the ecmail.ecc.cc.mo.us/~pre_eng/cgi-bin/mathcad.ini file in the following manner: # Directory in which you put it:Filename.Ext:Title to be displayed:Name or Creator print "Content-type: text/html\n\n"; print "Pre-Engineering Mathcad Tutorials"; print ""; print "

Pre-Engineering Tutorials

"; open (MCD, "dir -R1 ../tutorials|"); @mcd=; $num=0; foreach $mcd (@mcd) { if ($mcd =~ ":") { $dir="$mcd"; chop($dir); chop($dir); @dire=split(/\//, $dir); $dir=$dire[$#dire]; if ($num==0) {print "$dir
";} if ($num>0) {print "
$dir
";} $num++; } if ($mcd =~ ".mcd" || $mcd =~ ".ma") { chop($mcd); ($title, $name)=&GetInfo ($dir, $mcd); print "
  • $title: $name

  • \n"; }} ###################### sub GetInfo { my ($dir, $mcd) = @_; open (IN, "mathcad.ini"); @line=; close (IN); foreach $line (@line) { @in = split (/:/, $line); if ( $in[0] eq $dir && $in[1] eq $mcd) { @info=($in[2], $in[3]); }} return ( @info ); }