#!/bin/csh

killp -q logaxis
killp -q gnuplot
killp -q x.p
if (! -e gnuplot.fifo) mkfifo gnuplot.fifo
gnuplot < gnuplot.fifo &
x.p > gnuplot.fifo &

echo "set data style linespoints" > gnuplot.fifo

set toggle = 0

while (1)
    if ($toggle) set file = x.1
    if (! $toggle) set file = x.2

    logaxis 100 x > $file &
    sleep 5
    kill %3
    echo 'plot "<autodiff < '$file'"' > gnuplot.fifo
    sleep 1

    @ toggle ^= 1
end
