#!/usr/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# bos72L src/bos/usr/sbin/C2admin/lsC2admin.sh 1.2.1.1 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 1998,2018 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)70	1.2.1.1  src/bos/usr/sbin/C2admin/lsC2admin.sh, cmdsadm, bos72L, l2018_12A5 3/19/18 06:11:29
#
# lsC2admin
#
# Display the name of the current C2 System Administrative Host
#
# Usage:
#   lsC2admin
#

umask 027
unset PATH
export PATH=/usr/bin:/etc:/usr/sbin:/sbin:/usr/ucb

# ignore signals to prevent inconsistent state
trap "" INT HUP TERM QUIT EXIT

if ! isC2host 2>/dev/null
then
	dspmsg C2.cat 2 "%s: This system was not installed using the C2 option.\n" ${0##*/} >&2
	exit 1
fi

if [[ ! -f /etc/security/admin_host ]]
then
	dspmsg C2.cat 3 '%s: This system was not configured to operate the C2 option.\n' ${0##*/} >&2
	exit 2
fi

cat /etc/security/admin_host 2>/dev/null || {
	dspmsg C2.cat 4 '%s: An error occurred while determining the name of the administrative host.\n' ${0##*/} >&2
	exit 2
}

exit 0