#!/bin/sh
# Copyright (c) 1992, 1993 Black Market Technologies, Inc.
# This is proprietary software.  You must purchase a license for each computer
# on which you want to use this software.  For complete licensing information, 
# check the license agreement that came with this software or contact
# Black Market Technologies at +1 718 522-5090.
# 
# Usage: $0 port
# $Id: is-psinet,v 1.3 1993/08/22 19:12:03 treed Exp $
# $Author: treed $ $Date: 1993/08/22 19:12:03 $

# get dialin port

CIN=42

PROMPT="Connect It: ${CIN}: "
APP_PATH=$1
shift
PATH="${APP_PATH}/Scripts:${APP_PATH}:/etc:/usr/etc:/usr/ucb:/bin:/usr/bin"
export PATH

YES=0
NO=1
PROBLEM=9
TMPFILE=/tmp/${CIN}$$

if test $# != 1 ; then
#   echo "${PROMPT} No port specified" >&2
  exit 1
fi

HOST=$1

${APP_PATH}/filter-newlines < /etc/uucp/L.sys | egrep "^${HOST}" > ${TMPFILE}

PSI_STRING='term\\sdown'

if test "`grep \"${PSI_STRING}\" ${TMPFILE} >/dev/null 2>&1 ; echo $?`" = 0 ; then
  echo "${PROMPT} Remote computer is a PSI server" >&2
  /bin/rm -f ${TMPFILE}
  exit  ${YES}
else
  /bin/rm -f ${TMPFILE}
  exit  ${NO}
fi
