# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
bind pub - !bc pub:bc
proc pub:bc { nick uhost handle channel arg } {
exec echo $arg | bc -l > bc.out &
after 3000
set pid_bc [ catch "exec pgrep bc" ]
if { $pid_bc !=1 } {
exec killall bc
set out "plits!"
}
else{
set fp [ open "bc.out" r ]
set out [ read $fp ]
close $fp
}
putserv "PRIVMSG $channel :$out"
}