#!/usr/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# bos72L src/bos/usr/sbin/C2admin/lsCCadmin.sh 1.2.1.1 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2002,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 
# @(#)93	1.2.1.1  src/bos/usr/sbin/C2admin/lsCCadmin.sh, cmdsadm, bos72L, l2018_12A5 3/19/18 06:25:33
#
# lsCCadmin
#
# Display the name of the current CC System Administrative Host
#
# Usage:
#   lsCCadmin
#

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

isCChost -i 2>/dev/null
stat=$?
if [[ $stat -eq 2 ]]
then
	dspmsg CC.cat 2 "%s: This system was not installed using the CC option.\n" ${0##*/} >&2
	exit 1
fi

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

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

exit 0