runsman () {

    [ "$DISPLAY" != "" ] && echo $@ | awk '{for (k=j=i=1;i<=NF;i++) {
                if ($i=="-noht")j=0;
                if ($i=="-ht")j=1;
                if ($i=="-nogr")k=0;
                if ($i=="-gr")k=1;
                if ($i=="-nox"){j=0;k=0;}
                }
                if (j==1 || k==1) exit 0; else exit 1;}'

}

if runsman $otheropts ; then 
    exec $SPAD/bin/sman $otheropts -ws $serverws
else
    exec $serverws
fi

