#!/usr/share/sysman/bin/sysmansh @-ui cli
# *****************************************************************
# *                                                               *
# *   Copyright 2002 Compaq Information Technologies Group, L.P.  *
# *                                                               *
# *   The software contained on this media  is  proprietary  to   *
# *   and  embodies  the  confidential  technology  of  Compaq    *
# *   Computer Corporation.  Possession, use,  duplication  or    *
# *   dissemination of the software and media is authorized only  *
# *   pursuant to a valid written license from Compaq Computer    *
# *   Corporation.                                                *
# *                                                               *
# *   RESTRICTED RIGHTS LEGEND   Use, duplication, or disclosure  *
# *   by the U.S. Government is subject to restrictions  as  set  *
# *   forth in Subparagraph (c)(1)(ii)  of  DFARS  252.227-7013,  *
# *   or  in  FAR 52.227-19, as applicable.                       *
# *                                                               *
# *****************************************************************
# @(#)$RCSfile: suitjd,v $ $Revision: 1.4 $ (DEC) $Date: 2003/06/23 22:46:21 $

# authenticate the user using smauth

catch {authenticate stdin username cmdstring} rval
if {! [cequal $rval ""]} {
puts "The AMS software could not authenticate you"
close stdin
close stdout
exit} {_becomeUser $username}

# check to make sure the user is in the amsuser group or is root

set groups [ id groups ]
set rval [lsearch -exact $groups "amsuser"]
if {($rval == -1) && ([id userid ] != 0)} {
puts "You must be in the amsuser group to run this command"
close stdin
close stdout
exit}

# Call evmviewer in Java mode.

set env(SYSMANUI) JAVA
if [info exists env(DISPLAY)] {unset env(DISPLAY)}
while {[gets stdin line] < 0} {sleep 2}
set suitlet [lvarpop line]
switch $suitlet {
event_viewer {set suitlet "/usr/share/sysman/menu/tasks/evmviewer/evmviewer"}
default {puts -1
close stdin
close stdout
exit
}}
catch {execl $suitlet "$line"} res
puts $res
flush stdout
exit 1

