#!/bin/sh
#   Copyright (c) by Falcony (2:5020/828.777). This file is part of fidoip. It is free software and it is covered
#   by the GNU general public license. See the file LICENSE for details. */
#  Shows point's database and details info regarding selected point
SYSOS=`uname -s` # Packages architecture
OSTYPE=`uname -o 2>/dev/null || uname -p` 
TMP=`mktemp -d`	# Location of temp's files
SEDT="sed"  # Sed program type

T1="root"
T2="Linux"
T3="FreeBSD"
T4="DragonFly"
T5="NetBSD"
T6="OpenBSD"
T7="Cygwin" 
T8="Msys" 

if [ "$SYSOS" = "$T2" ]; then
Z1="Linux"
SEDT="sed"
fi

if [ "$SYSOS" = "$T3" ]; then
Z1="BSD"
SEDT="gsed"
fi

if [ "$SYSOS" = "$T4" ]; then
Z1="BSD"
Z2="PKGSRC"
SEDT="gsed"
fi

if [ "$SYSOS" = "$T5" ]; then
Z1="BSD"
Z2="PKGSRC"
SEDT="gsed"
fi

if [ "$SYSOS" = "$T6" ]; then
Z1="BSD"
SEDT="gsed"
fi

if [ "$OSTYPE" = "Cygwin" ]; then
Z1="Cygwin"
SEDT="sed"
fi

if [ "$OSTYPE" = "Msys" ]; then
Z1="Msys"
SEDT="sed"
fi

cat INSTALLDIR/usr/etc/binkd.cfg | grep " point "  > $TMP/point.list.tmp
 
cat $TMP/point.list.tmp | $SEDT "s|##||g" | $SEDT "s|  | |g" | $SEDT "s| point .*||g" |   grep -v "#"  | $SEDT "s/node//g" | $SEDT "s| - |   |g" >  $TMP/point.info.tmp
POINTINFO=`cat $TMP/point.info.tmp`

NUMBER=`cat $TMP/point.info.tmp | wc -l`

echo  "#=================================================="
echo "# $NUMBER point found in INSTALLDIR/usr/etc/binkd.cfg"
echo  "#=================================================="
echo "# Here is mailer informaion regarging these points"
echo "# in configuration file INSTALLDIR/usr/etc/binkd.cfg:"
echo "# Point number:     Password:   Description:"
echo  "#=================================================="
i=1
NUMBER=$(($NUMBER+1))
while [ "$i" -ne "$NUMBER" ]
do
echo " "$i" `$SEDT -n ""$i"p" $TMP/point.info.tmp`"
i=$(($i+1))
done
echo  "#=================================================="
rm -rf $TMP

