xref: /titanic_44/usr/src/cmd/bnu/Uutry (revision b7f45089ccbe01bab3d7c7377b49d80d2ae18a69)
1#!/usr/bin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#ident	"%Z%%M%	%I%	%E% SMI"	/* from SVR4 bnu:Uutry 2.6.1.8 */
24export IFS PATH
25IFS="
26"
27PATH="/usr/bin"
28
29#	This shell will start a uucico for the system given.
30#	Options:
31#	  -xN the debugging level for uucico (-x5 default)
32#	  -r  force the removal of the status file
33#	The output is put in /tmp/Name where Name is the name
34#	of the system name.  A tail -f is performed after uucico is started.
35
36STATUS=/var/uucp/.Status
37
38UUCICO=/usr/lib/uucp/uucico
39tty -s
40if [ "`pwd`" != "/usr/lib/uucp" -a "$?" = 0 -a -x "./uucico" ]; then
41	echo "OK to execute uucico from current directory (`pwd`)? y or n? \c"
42	read ans
43	if [ "$ans" = "y" ]
44	    then
45		UUCICO=./uucico
46	fi
47fi
48
49REMOVE=""
50X="-x5"
51SYS=
52while [ $# -gt 0 ]
53do
54	case $1 in
55	-c)  shift; CLASS="-c$1"; shift;;
56	-c*) CLASS="$1"; shift;;
57	-x)  shift; X="-x$1"; shift;;
58	-x*) X=$1; shift;;
59	-r) REMOVE="-f"; shift;;
60	-?) echo "$0: unrecognized flag $1\nUSAGE: $0 [-r] [-xdebug_level] system";exit 1;;
61	*) SYS="$1"; shift;;
62	esac
63done
64
65if [ -z "$SYS" ]
66then
67	echo "$0:  system name required"
68	exit 1
69fi
70
71#  check for existence in Systems file
72#  only accept match of full name
73#  (important because some names may be prefixes of others!)
74XX=
75XX=`uuname | grep "^${SYS}$" `
76if [ -z "$XX" ]
77then
78	echo "Invalid system name \"$SYS\""
79	exit
80fi
81
82STMP=/tmp/$SYS
83rm -f $STMP
84> $STMP
85chmod 622 $STMP
86#  remove old status file (can't actually remove, since $STATUS isn't
87#  publicly writable, but zero-ing it out works fine)
88if [ -n "$REMOVE" ]; then
89    cp /dev/null $STATUS/${SYS} 2>/dev/null
90fi
91
92echo "$UUCICO -r1 -s$SYS $CLASS $REMOVE $X >$STMP 2>&1&"
93$UUCICO  -r1 -s$SYS $CLASS $REMOVE $X >$STMP 2>&1&
94
95echo "tmp=$STMP"
96#	on heavily loaded systems, may take a moment for uucico
97#	to create debug file.
98if [ ! -f $STMP ]
99then
100	sleep 5
101fi
102tail -f $STMP
103