#!/bin/bash

# countdown = Copyright (c) 2002, 2003 John Morton.
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, 
# provided that the above copyright notice appear in all copies and that 
# both that copyright notice and this permission notice appear in supporting
# documentation.  No representations are made about the suitability of this
# software for any purpose.  It is provided "as is" without express or 
# implied warranty.
#
# This is roughly similar to a script I used to display a countdown timer
# on the screen used to project visuals at a New Years party. I added 
# a specific display argument and the mirror arg, as we were back projecting
# with a projector that didn't have it's own mirroring capability.
#
# As yaf-splash tends to die with X errors when xscreensaver is running
# under it and switches between GL and non-GL hacks, this script restarts
# it. If it exits cleanly, or with one of it's own command line args related
# error codes, this script exits as well.

yaf_splash_options="-transparent -placement top -font -adobe-avantgarde-demi-r-normal-*-*-560-*-*-p-*-iso8859-2"

if [ $# != 1 ]
then
  echo "Usage: $0 [datetime]" 
  exit 1
fi

while [ 1 ]
do
  yaf-splash $yaf_splash_options -countdown "$1"
  case $? in
    	[0123456789])
		break
		;;
	*)
		;;
  esac
  break
done

exit $?
