#!/bin/sh

# tcld-clean -- Clean Tcl debugger directory.
# tromey Mon Jul 25 1994

# KNOWN BUGS:
# * Shouldn't even exist.
# * Method for getting uid is bogus.  But is there a good way to get
#   this information?

whoami=`whoami`
uid=`(ypcat passwd 2>/dev/null || cat /etc/passwd) | grep "^$whoami:" | sed 's/^[^:]*:[^:]*:\([^:]*\):.*/\1/'`

cd /tmp/.debug${uid}
for i in *; do
   if /bin/kill -0 $i 2>/dev/null; then
      # Process exists.
      true
   else
      echo "Cleaning $i"
      /bin/rm -f $i
   fi
done

exit 0
