#!/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 tosser config information for selected point 
SYSOS=$(uname -s) # Packages architecture
TMP=$(mktemp -d)	# Location of temp's files
OSTYPE=$(uname -o 2>/dev/null || uname -p) 
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 "##" | grep " point " > $TMP/point.list.tmp
cat $TMP/point.list.tmp | $SEDT "s|point.*||g" | $SEDT "s/node//g" | $SEDT "s| - | |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 "# Mailer informaion regarging points in configuration file"
echo "# INSTALLDIR/usr/etc/binkd.cfg:"
echo "# Point number:     Password:   Description:"
echo  "#=================================================="
cat INSTALLDIR/usr/etc/binkd.cfg | grep "##" | grep " point " |  $SEDT "s|##||g" | $SEDT "s|  | |g" | $SEDT "s| point .*||g" |   grep -v "#"  | $SEDT "s/node//g" | $SEDT "s| - |   |g" 
POINTNUMBER=`echo $POINTINFO | $SEDT "s| .*||g" ` 
echo  "#================================================="
echo "# Tosser info of points (except .1) in configuration files:"
echo "# INSTALLDIR/usr/etc/fido/point.lst:"
echo  "#================================================="
cat INSTALLDIR/usr/etc/fido/point.lst | grep -v "#" 
echo  "#================================================="
echo

rm -rf $TMP

