#!/bin/sh
:
: Teardown
:
# pragma ident "@(#)bnu:Teardown	1.3 91/05/16 "
#
# Copyright 1991 Apple Computer, Inc.
# All Rights Reserved.
#
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF APPLE COMPUTER, INC.
# The copyright notice above does not evidence any actual or
# intended publication of such source code.
 
# Teardown   		1.1 12/10/90 common
# common:Teardown	1.2 1/17/90 10:10:53
# AT&T K18 bnu:Teardown	1.5 

export IFS PATH
IFS=" 	
"
PATH="/bin:/usr/bin"

#
#	This shell tries to convert uucp from the QFT format back to the
#	the regular HoneyDanBer format and removes all sub directories
#	that created while running the QFT version of uucp.
#

echo "Converting uucp from QFT Format back to HoneyDanBer format\n"

SPOOL=/usr/spool/uucp
#	chdir to remote spool directory
cd $SPOOL
if [ `pwd` != "$SPOOL" ]
then
	echo "CAN'T cd to $SPOOL"
	echo "$0 failed."
	exit 0
fi
for d in */?
do
#	chdir to grade directories of the remote
	cd $d
	if [ "$?" = 0 ]
	then
#	   move everything to parent (machine) directory
	   find . -print | cpio -pdvm ..
	   if [ "$?" = 0 ]
	   then
#		now remove everything in this directory
		rm -rf *
	   fi
	   cd $SPOOL
#	   if grade directory is now empty, remove it.
	   rmdir $d
	fi
done >/dev/null 2>&1
