#!/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.
# 
# $0 remotehostname
# $Id: is-nxfax,v 1.3 1993/08/03 02:08:23 treed Exp $
# $Author: treed $ $Date: 1993/08/03 02:08:23 $

CIN=41

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

PORT=$1

case "${PORT}" in
  A ) PORT=cua ;;
  B ) PORT=cub ;;
esac

for FOUND_QUEUE in `niutil -list . /fax_modems | awk '{print $2}'` ; do
  FOUND_MODEM="`niutil -read . /fax_modems/${FOUND_QUEUE} | egrep '^modem:' | awk -F':' '{print $2}'`"
  FOUND_PORT="`niutil -read . /fax_modems/${FOUND_QUEUE} | egrep '^device:' | awk -F':' '{print $2}`"
  case "${FOUND_PORT}" in
    */dev/cufa* ) FOUND_PORT=" /dev/cua " ;;
    */dev/cufb* ) FOUND_PORT=" /dev/cub " ;;
  esac
  if test "${FOUND_MODEM}" = " NXFax Fax Modem " -a "${FOUND_PORT}" = " /dev/${PORT} " ; then
    echo "${PROMPT} Found NX Fax Modem" >&2
    echo YES
    exit 
  fi
done

