#!/bin/csh -f
#*****************************************************************************
#                                                                            *
#            Copyright (C) 1993, Alias Research, Inc.                        *
#                                                                            *
#    These coded instructions,  statements and  computer programs contain    *
#    unpublished information proprietary to Alias Research, Inc.  and are    *
#    protected by the Canadian and US Federal copyright law. They may not    *
#    be disclosed to third parties  or copied  or duplicated, in whole or    *
#    in part,  without the prior written consent of Alias Research,  Inc.    *
#                                                                            *
# Unpublished-rights reserved under the Copyright Laws of the United States. *
#                                                                            *
#****************************************************************************/
#
#       $Source: /tmp_mnt/repo/root/v/alias3.2.2/src/Gifts/bin/RCS/drender_list.csh.sgi,v $
#       $Author: psantan $ $Date: 93/06/23 16:05:42 $
#
#

if (! $?ALIAS_LOCATION ) then
    echo "ALIAS_LOCATION environment variable must be set to install drender"
    exit -1
else
    set NT_DR=${ALIAS_WORKENV}/user_data/demo/misc_data/dlist.pst
    set NT_TMP=/usr/tmp/DRL.$$

    pst ${NT_DR}
    if ( $status == "1" ) then
        exit 1
    endif

    set NT_LIST_TYPE=`pstget ${NT_DR} '*.listing' 'all jobs'`
    set NT_JOB=`pstget ${NT_DR} '*.job' 'all'`

    if ( ${NT_JOB} == "all" || ${NT_JOB} == "ALL" || ${NT_JOB} == "" ) then
        set NT_FILTER=""
    else
        set NT_FILTER="+${NT_JOB}+"
    endif

    echo "*** D-Render job listing for `date` ***"
    if ( "${NT_LIST_TYPE}" == "pending jobs" || "${NT_LIST_TYPE}" == "all jobs" ) then

        echo "*** D-Render pending job listing    ***"
        /bin/ls -o ${NT_MASTER_DIR}/queue | grep '.job' > ${NT_TMP}
        if ( ${NT_FILTER} != "" ) then
            cat ${NT_TMP} | grep ${NT_FILTER} | nawk '{ print $3 " " $8 }'
        else
            cat ${NT_TMP} | nawk '{ print $3 " " $8 }'
        endif
    endif

    if ( "${NT_LIST_TYPE}" == "failed jobs" || "${NT_LIST_TYPE}" == "all jobs" ) then

        echo "*** D-Render failed job listing     ***"
        /bin/ls -o ${NT_MASTER_DIR}/failed | grep '.job' > ${NT_TMP}
        if ( ${NT_FILTER} != "" ) then
            cat ${NT_TMP} | grep ${NT_FILTER} | nawk '{ print $3 " " $8 }'
        else
            cat ${NT_TMP} | nawk '{ print $3 " " $8 }'
        endif
    endif

    if ( "${NT_LIST_TYPE}" == "completed jobs" || "${NT_LIST_TYPE}" == "all jobs" ) then

        echo "*** D-Render completed job listing  ***"
        /bin/ls -o ${NT_MASTER_DIR}/completed | grep '.job' > ${NT_TMP}
        if ( ${NT_FILTER} != "" ) then
            cat ${NT_TMP} | grep ${NT_FILTER} | nawk '{ print $3 " " $8 }'
        else
            cat ${NT_TMP} | nawk '{ print $3 " " $8 }'
        endif
    endif

    if ( "${NT_LIST_TYPE}" == "running jobs" || "${NT_LIST_TYPE}" == "all jobs" ) then

        echo "*** D-Render running job listing    ***"
        /bin/ls -o ${NT_MASTER_DIR}/running | grep '_on_' > ${NT_TMP}
        if ( ${NT_FILTER} != "" ) then
            cat ${NT_TMP} | grep ${NT_FILTER} | nawk '{ print $3 " " $8 }'
        else
            cat ${NT_TMP} | nawk '{ print $3 " " $8 }'
        endif
    endif

    /bin/rm -f ${NT_TMP}
endif






