#!/bin/sh -f
# see if WinCenter is running for user
# 
# usage: wnccheck nthost <username>
#
# prints 'yes' if the user is on the host, 'no' otherwise.  a 0 return
# code means 'yes', non-zero means 'no'.
#

nullcmd=mem
username=$USER
case $# in
0)
    echo Usage: `expr //$0 : '.*/\(.*\)'` 'NT-hostname [username]'
    exit 1
    ;;
1)
    hostname=$1
    ;;
*)
    hostname=$1
    username=$2
    ;;
esac

response=`rsh $hostname -l $username $nullcmd 2>&1`

case $response in
*WinStation*|*refused)
    echo "no"
    exit 1
    ;;
*)
    echo "yes"
    exit 0
    ;;
esac
