1*7c478bd9Sstevel@tonic-gate#!/bin/sh 2*7c478bd9Sstevel@tonic-gate# 3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START 4*7c478bd9Sstevel@tonic-gate# 5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 7*7c478bd9Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 8*7c478bd9Sstevel@tonic-gate# with the License. 9*7c478bd9Sstevel@tonic-gate# 10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 13*7c478bd9Sstevel@tonic-gate# and limitations under the License. 14*7c478bd9Sstevel@tonic-gate# 15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 20*7c478bd9Sstevel@tonic-gate# 21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END 22*7c478bd9Sstevel@tonic-gate# 23*7c478bd9Sstevel@tonic-gate# 24*7c478bd9Sstevel@tonic-gate# Copyright 1995 Sun Microsystems, Inc. All rights reserved. 25*7c478bd9Sstevel@tonic-gate# Use is subject to license terms. 26*7c478bd9Sstevel@tonic-gate# 27*7c478bd9Sstevel@tonic-gate#ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gateexport IFS PATH 29*7c478bd9Sstevel@tonic-gateIFS=" 30*7c478bd9Sstevel@tonic-gate" 31*7c478bd9Sstevel@tonic-gatePATH="/usr/bin" 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate# 34*7c478bd9Sstevel@tonic-gate# usage: 35*7c478bd9Sstevel@tonic-gate# uulog 36*7c478bd9Sstevel@tonic-gate# or uulog foo 37*7c478bd9Sstevel@tonic-gate# or uulog -sfoo 38*7c478bd9Sstevel@tonic-gate# or uulog -s foo 39*7c478bd9Sstevel@tonic-gate# or uulog -ffoo 40*7c478bd9Sstevel@tonic-gate# or uulog -f foo 41*7c478bd9Sstevel@tonic-gate# 42*7c478bd9Sstevel@tonic-gate# -x means check the execute file 43*7c478bd9Sstevel@tonic-gate# -nnn where 'nnn' is a number will do tail -nnn 44*7c478bd9Sstevel@tonic-gate# 45*7c478bd9Sstevel@tonic-gateLOGDIR=/var/uucp/.Log 46*7c478bd9Sstevel@tonic-gatetype=uucico 47*7c478bd9Sstevel@tonic-gatefflag="" 48*7c478bd9Sstevel@tonic-gatesys="" 49*7c478bd9Sstevel@tonic-gaten="" 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gatecd $LOGDIR 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gatewhile getopts :xf:s:0123456789 FLAG; do 54*7c478bd9Sstevel@tonic-gate case $FLAG in 55*7c478bd9Sstevel@tonic-gate x) type=uuxqt 56*7c478bd9Sstevel@tonic-gate ;; 57*7c478bd9Sstevel@tonic-gate f) fflag=1 58*7c478bd9Sstevel@tonic-gate sys="$sys $OPTARG" 59*7c478bd9Sstevel@tonic-gate ;; 60*7c478bd9Sstevel@tonic-gate s) sys="$sys $OPTARG" 61*7c478bd9Sstevel@tonic-gate ;; 62*7c478bd9Sstevel@tonic-gate :) gettext "uulog: System name must follow -$OPTARG flag\n" 1>&2 63*7c478bd9Sstevel@tonic-gate exit 1 64*7c478bd9Sstevel@tonic-gate ;; 65*7c478bd9Sstevel@tonic-gate [0-9]) n=$n$FLAG 66*7c478bd9Sstevel@tonic-gate ;; 67*7c478bd9Sstevel@tonic-gate *) gettext "Usage: uulog [-x] [-f system] | [[-number] [-s system...]]\n" 1>&2 68*7c478bd9Sstevel@tonic-gate exit 1 69*7c478bd9Sstevel@tonic-gate ;; 70*7c478bd9Sstevel@tonic-gate esac 71*7c478bd9Sstevel@tonic-gatedone 72*7c478bd9Sstevel@tonic-gate 73*7c478bd9Sstevel@tonic-gateshift `expr $OPTIND - 1` 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gatesys="$sys $*" 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gateset - $sys 78*7c478bd9Sstevel@tonic-gateif [ x$fflag = x ]; then 79*7c478bd9Sstevel@tonic-gate if [ $# = 0 ]; then 80*7c478bd9Sstevel@tonic-gate set - `/usr/bin/ls $type` 81*7c478bd9Sstevel@tonic-gate fi 82*7c478bd9Sstevel@tonic-gate for i in $* 83*7c478bd9Sstevel@tonic-gate do 84*7c478bd9Sstevel@tonic-gate if [ -f $type/$i ] 85*7c478bd9Sstevel@tonic-gate then 86*7c478bd9Sstevel@tonic-gate if [ x$n = x ]; then 87*7c478bd9Sstevel@tonic-gate cat $type/$i 88*7c478bd9Sstevel@tonic-gate else 89*7c478bd9Sstevel@tonic-gate tail -$n $type/$i 90*7c478bd9Sstevel@tonic-gate fi 91*7c478bd9Sstevel@tonic-gate else 92*7c478bd9Sstevel@tonic-gate printf "`gettext 'uulog: No log file available for system %s'`\n" $i 1>&2 93*7c478bd9Sstevel@tonic-gate exit 1 94*7c478bd9Sstevel@tonic-gate fi 95*7c478bd9Sstevel@tonic-gate done 96*7c478bd9Sstevel@tonic-gateelse 97*7c478bd9Sstevel@tonic-gate if [ $# != 1 ]; then 98*7c478bd9Sstevel@tonic-gate gettext "uulog: Only one system allowed with -f\n" 1>&2 99*7c478bd9Sstevel@tonic-gate exit 2 100*7c478bd9Sstevel@tonic-gate fi 101*7c478bd9Sstevel@tonic-gate if [ -f $type/$1 ] 102*7c478bd9Sstevel@tonic-gate then 103*7c478bd9Sstevel@tonic-gate exec tail -${n}f $type/$1 104*7c478bd9Sstevel@tonic-gate else 105*7c478bd9Sstevel@tonic-gate printf "`gettext 'uulog: No log file available for system %s'`\n" $1 1>&2 106*7c478bd9Sstevel@tonic-gate exit 1 107*7c478bd9Sstevel@tonic-gate fi 108*7c478bd9Sstevel@tonic-gatefi 109