#! /bin/sh

# Copyright (C) 1999, Free Software Foundation
# Originally by Alexandre Oliva <oliva@gnu.org>

# This script is Free Software, and it can be copied, distributed and
# modified as defined in the GNU General Public License.  A copy of
# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html

# Test whether a CVS directory has become inactive, i.e., if it would
# not have been checked out with cvs co -P -d.  It is useful for
# situations in which a directory is wiped out (or moved) in the CVS
# repository, but cvs doesn't remove it locally for some reason, such
# as -P not being specified.

# A list of directories can be specified, in which case the test will
# succeed if *none* of the directories are active.

# If no directory is specified, the current directory is assumed.

# Usage: if cvs-is-empty /path/to/directory; then do-sth; fi

test $# = 0 && set .

for d
do
  if test x"`ls -1a $d | grep -v '^.$' | grep -v '^..$'`" != x"CVS"; then
    exit 1
  fi
done

exit 0
