#!/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
# $Id: get-domainname,v 1.4 1993/08/01 06:14:32 treed Exp treed $
# $Author: treed $ $Date: 1993/08/01 06:14:32 $

# get name of mailhost 

CIN=3

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

SENDMAIL_FILENAME="`${APP_PATH}/Scripts/get-sendmail.cf-filename ${APP_PATH} 2>/dev/null`"

if test ! -f "${SENDMAIL_FILENAME}"  ; then
#  echo "Connect It: ${CIN}: Not enough arguments">&2
  exit ${PROBLEM}
fi

DOMAINNAME="`egrep '^Dm' ${SENDMAIL_FILENAME} | sed 's/^Dm//'`"
echo ${DOMAINNAME}
if test "${DOMAINNAME}" = "" ; then
#  echo "Connect It: ${CIN}: Could not determine domainname" >&2
  exit ${PROBLEM}
else
#  echo "Connect It: ${CIN}: Retrieved domainname ${DOMAINNAME}" >&2
  exit ${YES}
fi
