#!/bin/sh

cache=/usr/spool/rwho/cache/rwho


prog=`basename $0`

for i do
    case "$i" in
    -a)
        cache=$cache-a;;
    *)
        echo "Usage: $prog [-a]"; exit 1;;
    esac
done

# mv(1) executed on the NFS server does not seem to be an atomic
# operation from the NFS client's point of view.  To avoid an error
# message, retry reading the cache file a few times.

for i in 1 2 3 4; do
    if /bin/cat $cache 2>/dev/null; then
        exit 0
    fi
    /bin/sleep 1
done

exec /bin/cat $cache
