#!/bin/ksh # @(#) *---------------------------------------------------------------* # @(#) | [richelp] Displays a particular system message corresponding | # @(#) | to a RIC message number. | # @(#) | ARTIC960 - korn shell script | # @(#) *---------------------------------------------------------------* #*----------------------------------------------------------------------------* #| Filename: richelp | #| | #| Input Parameters : | #| parameter 1 : Error message number | #| | #| Dependencies : | #| RICPATH variable definition | #| | #*----------------------------------------------------------------------------* trap "echo '\n[Break] richelp interrupted, script terminated ...';exit 1" 2 3 9 15 function err1 { echo "*--------------------------------------------------------------------*" echo "| Command Syntax : richelp |" echo "| |" echo "| where: |" echo "| |" echo "| : ARTIC960 message number. ( format RICxxxx ) |" echo "*--------------------------------------------------------------------*" exit 1 } function err2 { echo "*--------------------------------------------------------------------*" echo "| [Fatal Error] : RICPATH not set, cannot continue. |" echo "| |" echo "| Action : Set the RICPATH environment variable. |" echo "| |" echo "*--------------------------------------------------------------------*" exit 1 } function err3 { echo "*--------------------------------------------------------------------*" echo "| [Fatal Error] : ARTIC960 Support Program not found at the |" echo "| specified RICPATH location, cannot continue. |" echo "| |" echo "| Action : Check the RICPATH environment variable. |" echo "| |" echo "*--------------------------------------------------------------------*" exit 1 } # --------------------------------------------------------------------------- # Command line parameters checking # --------------------------------------------------------------------------- if test $# -lt 1 || test $# -gt 1 || [ "${1}" = "?" ] ; then err1 ; fi # invalid command line parameter # or help syntax requested msgnum=`echo ${1} | tr '[a-z]' '[A-Z]'` # Set all uppercase alpha chars. echo ${msgnum} | grep -q -E "RIC[0-9][0-9][0-9][0-9]" if [ $? != 0 ] ; then echo "\n[richelp] The system detects an invalid message number ${msgnum}" echo "format ( format RICxxxx, where 'x' is a numeric digit).\n" exit 1 fi if [ "${RICPATH}" = "" ] ; then err2 ; fi # RICPATH not defined if [ ! -d "${RICPATH}/bin" ] ; then err3 ; fi # ARTIC960 product not installed # --------------------------------------------------------------------------- # Search for the error message inside the rich.txt file # --------------------------------------------------------------------------- grep -q ${msgnum} ${RICPATH}/sys/rich.txt if [ $? != 0 ] ; then echo "\n[richelp] The system cannot find message ${msgnum}" echo "in message file rich.txt.\n" exit 1 fi echo # fixed ptr 1173, 1736 PJB dspcat ${RICPATH}/sys/ric.cat 1 `echo ${msgnum} | sed "s/RIC//g"` | sed "s/\$s//g" echo sed -n "/${msgnum}/ { :lab2 n s/RIC.....:// t p b lab2 }" ${RICPATH}/sys/rich.txt # --------------------------------------------------------------------------- # End of richelp script file # --------------------------------------------------------------------------- exit 0