8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / bnu / Uutry
blob99a4e0f0ca1ca4c8abb08d8615178f8c916415b2
1 #!/usr/bin/sh
3 # CDDL HEADER START
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.
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.
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]
21 # CDDL HEADER END
23 #ident "%Z%%M% %I% %E% SMI" /* from SVR4 bnu:Uutry 2.6.1.8 */
24 export IFS PATH
25 IFS="
27 PATH="/usr/bin"
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.
36 STATUS=/var/uucp/.Status
38 UUCICO=/usr/lib/uucp/uucico
39 tty -s
40 if [ "`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
49 REMOVE=""
50 X="-x5"
51 SYS=
52 while [ $# -gt 0 ]
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
63 done
65 if [ -z "$SYS" ]
66 then
67 echo "$0: system name required"
68 exit 1
71 # check for existence in Systems file
72 # only accept match of full name
73 # (important because some names may be prefixes of others!)
74 XX=
75 XX=`uuname | grep "^${SYS}$" `
76 if [ -z "$XX" ]
77 then
78 echo "Invalid system name \"$SYS\""
79 exit
82 STMP=/tmp/$SYS
83 rm -f $STMP
84 > $STMP
85 chmod 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)
88 if [ -n "$REMOVE" ]; then
89 cp /dev/null $STATUS/${SYS} 2>/dev/null
92 echo "$UUCICO -r1 -s$SYS $CLASS $REMOVE $X >$STMP 2>&1&"
93 $UUCICO -r1 -s$SYS $CLASS $REMOVE $X >$STMP 2>&1&
95 echo "tmp=$STMP"
96 # on heavily loaded systems, may take a moment for uucico
97 # to create debug file.
98 if [ ! -f $STMP ]
99 then
100 sleep 5
102 tail -f $STMP