:
#!/bin/bash
#
# briefme - top package agent. Copyright (c) 1993 (Gil Nardo)
#	see files in NOTICE for legalease

_briefme()
{
#
# README starts here
#

more <<-TOHERE

	This is a port of 'blobs' originally written by Russell Wallace
	and ported to Linux by Gil Nardo (gil@netcom.com).

	The idea is simple: microbes (or blobs) fly around on the screen
	and zap each other. You can control the pseudo-random violence
	via command line parameters.
	
	This README file doubles as both a README and as a Bash executable
	package agent -- a program that helps navigate, explain, and
	maintain parts of a software package. { Package Agent (tm) :-) }

	For those who do not have the command shell 'Bash', or have
	trouble using this script, or wish to go straight to using
	the package, here are the manual directions to follow to get
	you going, ASAP.

	1) execute make
	2) run blobs with parameters 15 10 20 50 1
	3) for help just run blobs without any parameters


	The files located at this level are

	README*		readable bash executable package agent
	blobs.c		blobs source
	msleep.c	source for micro second sleeps
	makefile	create blobs program
	NOTICE		damn legalease
	COPYING		more damn legalease

TOHERE

#
# README ends here
#

}




# Prompt for yes or no answer - returns non-zero for no
_getyn()
{
        while   echo -n "$* (y/n) ">&2
        do      read yn rest
                case $yn in
                [yY])   return 0                      ;;
                [nN])   return 1                      ;;
                *)      echo "Please answer y or n" >&2 ;;
                esac
        done
}

# look for an archive sitting with the README file
_check_archive()
{
	local ARCNAME
	local ARCPLACE

	ARCNAME=$1

	if [ ! -f $ARCNAME ]
	then return
	fi

	echo Archive file ${ARCNAME} is available

	case $ARCNAME in

		*.taz)
			if (_getyn "Extract files from gzipped tar?")
			then
				tar -zxvf $ARCNAME
			fi
			;;

		*.tgz | *.tpz)
			if (_getyn "Reverse gzip then extract from tar?")
			then
				gunzip < $ARCNAME | tar -xvf -
			fi
			;;

		*.tar)
			if (_getyn "Extract files from tar?")
			then
				tar xvf $ARCNAME
			fi
			;;

		*)
			echo Dont know how to handle archive file $ARCNAME
			return
			;;
	esac

	ARCPLACE=archive

	if (_getyn "Move $ARCNAME to directory $ARCPLACE?")
	then
		if [ ! -d  $ARCPLACE ]
		then
			mkdir $ARCPLACE
		fi
		if [ ! -d $ARCPLACE ]
		then
			echo Could not create $ARCPLACE directory
			return
		fi
		mv $ARCNAME $ARCPLACE
	fi

}

#
# main()
#
	QUICKLY=$1

	_briefme

	if [ -z "$BASH_VERSION" ]
	then
		echo "I want to be bash'd!"
		_getyn "Continue running in this shell anyway?" || exit
	fi

	_check_archive `echo *.tgz`

	if [ ! -z "$QUICKLY" ]
	then exit
	fi

	_getyn "make the executables?" && make

	_getyn "clean up objects?" && make clean
