#!/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-dialin,v 1.4 1993/08/02 07:17:45 treed Exp $
# $Author: treed $ $Date: 1993/08/02 07:17:45 $

# get dialin port

CIN=20

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

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

TTYS_FILE=/etc/ttys

PORT=$1

case "${PORT}" in
  cua ) PORT=ttyda ;;
  cub ) PORT=ttydb ;;
  cufa ) PORT=ttydfa ;;
  cufb ) PORT=ttydfb ;;
esac

ENTRY="`egrep \"^$PORT\" ${TTYS_FILE}`"
STATUS="`echo ${ENTRY} | awk '{print $5}'`"

if test "${STATUS}" = on ; then
#   echo "${PROMPT} Port turned on" >&2
  exit ${YES}
else
#   echo "${PROMPT} Port turned off" >&2
  exit ${NO}
fi
