#! /bin/sh
#
# ck4up.sh 
# Script to show the diff-output of ck4up with firefox
#
# Jürgen Daubert <juergen.daubert@t-online.de>

PROG='%%PREFIX%%/bin/ck4up'
DIFF=`$PROG $@ | awk '{if ($3 ~ /diff:/) {print $4} else {print $0 > "/dev/stderr"}}'`
TEST_MOZ=`ps ax | grep -v grep | grep -c firefox`

for PAGE in $DIFF; do
   echo $PAGE
   if [ $TEST_MOZ -ge 1 ]; then
      firefox -remote "openURL($PAGE, new-tab)"
   else
      firefox $PAGE &
      TEST_MOZ=1
      sleep 3
   fi 
done

# End of file


syntax highlighted by Code2HTML, v. 0.9.1