#!/usr/bin/bsh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# bos720 src/bos/usr/bin/uucp/uukick 1.9 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 1985,1996 
# 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 
# 
# COMPONENT_NAME: CMDUUCP uukick
# 
# FUNCTIONS: 
#
# ORIGINS: 10  27  3 
#
# (C) COPYRIGHT International Business Machines Corp. 1985, 1996
# All Rights Reserved
# Licensed Materials - Property of IBM
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
# @(#)34	1.9  src/bos/usr/bin/uucp/uukick, cmduucp, bos720 3/20/96 16:24:41
#	This shell will start a uucico for the system given.

STATUS=/usr/spool/uucp/.Status
UUCICO=/usr/sbin/uucp/uucico
CMD=`basename $0`

X="-x5"
SYS=
for arg
do
	case $arg in
	-x*) X=$arg;;
        -*) if [ -x /usr/bin/dspmsg ];
                then
                     MSG=`dspmsg uucp.cat 7 "%s: Invalid argument %s.\n" $CMD $1;`
                     echo $MSG;
                     MSG=`dspmsg uucp.cat 9 "Usage: %s [ -xDebugLevel ] SystemName\n" $CMD;`
                     echo $MSG;
                else
                     MSG="$CMD: Invalid argument $1.\n";
                     echo $MSG;
                     MSG="Usage: $CMD [ -xDebugLevel ] SystemName\n";
                     echo $MSG;
            fi
            exit 1;;
	*) SYS="$arg";;
	esac
done
if [ -z "$SYS" ]
then
     	if [ -x /usr/bin/dspmsg ];
		then
		     MSG=`dspmsg uucp.cat 1 "%s:  system name required\n" $CMD;`
                     echo $MSG;
                     MSG=`dspmsg uucp.cat 9 "Usage: %s [ -xDebugLevel ] SystemName\n" $CMD;`
                     echo $MSG;
  		else 
		     MSG="$CMD:  system name required\n";
                     echo $MSG;
                     MSG="Usage: $CMD [ -xDebugLevel ] SystemName\n";
                     echo $MSG;
     	fi
	exit 1
fi

#  use 7 character maximum name length (SYSNSIZE in uucp.h) for serach
SYSTEM=`echo $SYS | cut -c1-7`

#  check for existence in Systems file
XX=
XX=`uuname | grep $SYSTEM `
if [ -z "$XX" ]
then
     	if [ -x /usr/bin/dspmsg ];
	       then dspmsg uucp.cat 2 "Invalid system name \"%s\"" $SYSTEM;
        	else echo "Invalid system name \"$SYSTEM\""
     	fi
	exit
fi
set $XX
FULLNAME=$1
for i
do
    if [ $i = $SYS ]; then
	FULLNAME=$SYS
	break
    fi
done

rm -f $STATUS/${FULLNAME}

$UUCICO  -r1  $X -s$FULLNAME &