#!/bin/sh

usage()
{
    exec 1>&2
    echo "usage: ${0##*/} program [args ...]"
    echo "  to prevent the laptop from sleeping while 'program' is running"
    exit 1
}

case $1 in
    -*|"")  usage ;;
esac

# powerd will clean this up after we're gone.  and if the touch
# doesn't work, it's probably because powerd's not running and the
# directory isn't there /var/run.
touch /var/run/powerd-inhibit-suspend/$$ 2>/dev/null

exec "$@"

