This commit is contained in:
mcafee%netscape.com 2001-11-27 04:43:32 +00:00
Родитель fc8b9e3c05
Коммит ce346ab569
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -45,6 +45,16 @@ sub show_graph {
my $PNGFILE = "/tmp/gnuplot.$$"; my $PNGFILE = "/tmp/gnuplot.$$";
# Find gnuplot, sorry this is for solaris.
my $gnuplot;
if(-f "/usr/bin/gnuplot") {
$gnuplot = "/usr/bin/gnuplot";
} elsif(-f "/usr/local/bin/gnuplot") {
$gnuplot = "/usr/local/bin/gnuplot";
} else {
die "Can't find gnuplot.";
}
# interpolate params into gnuplot command # interpolate params into gnuplot command
my $cmds = qq{ my $cmds = qq{
reset reset
@ -65,7 +75,7 @@ sub show_graph {
plot "$DATAFILE" using 1:2 with points ls 1, "$DATAFILE" using 1:2 with lines ls 2 plot "$DATAFILE" using 1:2 with points ls 1, "$DATAFILE" using 1:2 with lines ls 2
}; };
open (GNUPLOT, "| /usr/bin/gnuplot") || die "can't fork: $!"; open (GNUPLOT, "| $gnuplot") || die "can't fork: $!";
print GNUPLOT $cmds; print GNUPLOT $cmds;
close (GNUPLOT) || die "can't close: $!"; close (GNUPLOT) || die "can't close: $!";
open (GNUPLOT, "< $PNGFILE") || die "can't read: $!"; open (GNUPLOT, "< $PNGFILE") || die "can't read: $!";