#!/bin/sh  

# Filename:  drop_table
# Description:  This script attempts to delete an existing message area
# Author:	Greg Shaw
# Created:	6/13/96

# BBSDIR set?
if [ "$BBSDIR" = "" ]; then
	echo Please run this script as user bbs.
	exit 1
fi

# right number of arguments?

if [ $# -ne 1 ]; then
	echo "USAGE: $0 <table_name>"
	exit 1
fi

tablename=$1


# check for msql
if [ ! -x $BBSDIR/msql/bin/msql ]; then
	echo Please compile and install the mSQL package prior to executing
	echo this utility.
	exit 1
fi

# the following items are assumed not to change on a regular basis.  
# however, to create a message area with different parameters, simply edit
# the following:
# (I wouldn't change the first 3)

$BBSDIR/msql/bin/msql rocat <<EOF

drop table $1\g
drop table $1_thread\g
delete from info where table_name='$1'\g

EOF

echo $tablename dropped.
