#!/bin/sh

# mkbb.cols
# SCRIPT TO DETERMINE COLUMNS TO DISPLAY
# Sean MacGuire - The MacLawran Group Inc.
# Version 1.4
# Mar 05th, 2000
#
# This program is Copyright (c) 1997-2000
# The MacLawran Group Inc.
# All Rights Reserved

if test "$#" = 1
then
	BBHOSTLINE="$1"
fi

if test ! "$BBTMP"                      # GET DEFINITIONS IF NEEDED
then
        . $BBHOME/etc/bbdef.sh          # INCLUDE STANDARD DEFINITIONS
fi

#
# IF WE'RE CALLED WITH AN ARGUMENT WE'RE IN COMPRESSED MODE...
# THIS ARGUMENT IS "0" WHEN CALLED FROM mkbb2.sh...
#
if test "$BBHOSTLINE"				# COMPRESSED MODE
then
	if test "$BBHOSTLINE" != "0"		# CALLED FROM mkbb2.sh
	then
		BBARGS=`$BBHOME/web/mkbb.comp $BBHOSTLINE`
	fi
else
	BBARGS="*.*"
fi

#
# THANKS TO: Bill Petersen <brpeters@tssun7.dsccc.com>
#
if test "$BBHOSTLINE" = "0"		# CALLED FROM mkbb2.sh
then
	$CAT $BBTMP/BB | $GREP -v "^summary" | $SED 's/.*\.//'|$SORT|$UNIQ
else					# NORMAL COMPRESSED DISPLAY
	if test "$BBARGS"		# HANDLE "NOTHING" ELEGANTLY
	then
		cd $BBLOGS
		$LS $BBARGS|$GREP -v "^dialup"|$GREP -v "^summary"|$SED 's/.*\.//'|$SORT|$UNIQ
	fi
fi
