--- loncom/homework/lonmaxima.pm 2010/06/14 11:34:18 1.29 +++ loncom/homework/lonmaxima.pm 2017/03/05 19:30:56 1.32 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Interface routines to MAXIMA CAS # -# $Id: lonmaxima.pm,v 1.29 2010/06/14 11:34:18 www Exp $ +# $Id: lonmaxima.pm,v 1.32 2017/03/05 19:30:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -51,7 +51,7 @@ sub maximareply { print $socket &escape($cmd)."\n"; my $reply=<$socket>; chomp($reply); - if ($reply=~/^Incorrect/) { $reply='Error: '.$reply; } + if ($reply=~/^Incorrect/i) { $reply='Error: '.$reply; } return &unescape($reply); } else { return 'Error: no connection.'; @@ -155,6 +155,9 @@ sub maxima_eval { sub compareterms { my ($socket,$terma,$termb)=@_; + if ($terma =~ m{[.*^/\s]+(|\(\s*\()$}) { + return 'Error: blacklisted'; + } my $difference=$terma.'-('.$termb.')'; if (&blacklisted($difference)) { return 'Error: blacklisted'; } my $reply=&maximareply($socket,'trigsimp(trigreduce('.$difference.'));');