#!/usr/local/bin/perl # CHANGE THE ABOVE LINE WITH THE LOCATION OF perl IN YOUR SYSTEM # TO FIND OUT WHERE PERL IS USE THE UNIX COMMAND # which perl # IF YOUR SYSTEM DOESN'T HAVE PERL YOU CAN GET IT FROM: # http://www.cis.ufl.edu/perl/ftp.html # COMPLETE INFORMATION ABOUT PERL IS AT: # http://www.cis.ufl.edu/perl # OTHER TWO SYSTEM DEPENDENT COMMANDS: mail, uufiles. # YOU MAY HAVE TO CHANGE ONE OR BOTH OF THESE COMMANDS # TO WORK WITH YOUR SYSTEM. # THE FOLLOWING mail COMMAND SHOULD WORK WITH UNIX BSD. ################################################################### $mail = "/usr/ucb/mail -s"; # mail command with subject switch $uufiles = "uufiles -gz"; # uufiles command in your system ################################################################### # IF YOU USE UNIX SYSTEM V TRY TO CHANGE THE mail COMMAND ABOVE TO: # $mail = "/usr/bin/mailx -s"; # TO CHECK IF THESE COMMANDS WILL WORK FOR YOU TRY: # cat ~/.cshrc | /usr/ucb/mail -s put youruserid # IF YOU RECIEVE YOUR .cshrc FILE WITH SUBJECT put IT'S WORKING. # REMEMBER TO MAKE THIS FILE (i.e. xxx.pl) AND THE FILE uufiles # EXECUTABLE WITH THE COMMAND: # chmod +x xxx.pl uufiles # IF YOUR SYSTEM DOESN'T HAVE gnuzip REPLACE "uufiles -gz" # ABOVE WITH JUST "uufiles". ########### END OF SYSTEM DEPENDENT COMMANDS ############### # # I have to skip first line $l1 = <>; $host = &next_line; if("$host" !~ /^[\w \.]*$/) { print "\n****** funny host name! $host *****\n"; exit; } if("$host" !~ /^xxx\.lanl\.gov$|^omega\.math\.albany\.edu$/i) { print "\n****** funny host! $host *****\n"; exit; } $archive = &next_line; if("$archive" !~ /^[a-z]+\-[a-z]+$|^cr569$/) { print "\n****** funny archive! $archive *****\n"; exit; } $command = &next_line; $doc = &next_line; if("$doc" !~ /^[\/ \w \. \-]*$/i) { print "\n***** funny doc name! $doc ******\n"; exit; } if("$doc" =~ /(^\s*\.)|(\/\.)|mail|(^\s*\/etc)/i ) { print "\n****** funny doc! $doc *****\n"; exit; } if ( $command eq "put") { # read the header while (<> !~ /^\-\-\-\-\-Begin header/) { } $header = <>; while (($_ = <>) !~ /^\-\-\-\-\-End header/) { $header .= $_; } # prepare doc to be sent open(UUF, "| $uufiles") || die "cannot launch \"\| $uufiles\""; print UUF "$doc\n"; print UUF "*\n"; print UUF "$doc\n"; close(UUF); $doc_uu = "$doc".".uu"; open(DOC, "$doc_uu") || die "cannot open $doc_uu for reading"; open(MAIL, "| $mail put $archive\@$host") || die "cannot open MAIL" ; print MAIL "$header"; while () { print MAIL $_; } close(DOC); close(MAIL); # ### print "\n******************************* You are Done! if everything went OK... there is now one more bayes-an\@xxx paper. *******************************\n"; } else { print "Don't know command $command\n"; } ############ END OF MAIN ############# # sub next_line { local ($x); $x = <>; chop($x); $x =~ s/^.*:\s*//; $x; }