# Copyright (C) 1997 Capella Computers Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

# :FILE:
# Useful shell functions complementing the shell scripts.

# SHELL FUNCTIONS:

# List new jobs.
function p4jln {
    p4jl +n $*
}

# List work jobs.
function p4jlw {
    p4jl +w $*
}

# List review jobs.
function p4jlr {
    p4jl +r $*
}

# List failed jobs.
function p4jlf {
    p4jl +f $*
}

# List passed jobs.
function p4jlp {
    p4jl +p $*
}

# List integration jobs.
function p4jli {
    p4jl +i $*
}

# List clear jobs.
function p4jlc {
    p4jl +c $*
}

# List done jobs.
function p4jld {
    p4jl +d $*
}

# List user jobs (requires arguments).
function p4jlu {
    p4jl +u $*
}

# List my jobs jobs (very useful together with '-d').
function p4jlm {
    p4jl +u me $*
}

# Environment functions:

# Print the environment.
function p4el {
    echo P4ROOT=$P4ROOT
    echo P4TEMP=$P4TEMP
    echo P4PATH=$P4PATH
    echo P4PORT=$P4PORT
    echo P4CLIENT=$4CLIENT
    echo P4USER=$P4USER
    echo P4JOB=$P4JOB
}

# Set the current job.
function p4ej {
    case $1 in
	"")
	    echo P4JOB=$P4JOB
	    ;;
	-)
	    unset P4JOB
	    ;;
	*)
	    export P4JOB=$1
	    ;;
    esac
}

if [ "$P4SHIFTER" -gt 0 ]
then
    # Set the current user.
    function p4eu {
	case $1 in
	"") echo P4USER=$P4USER
	    ;;
	-)  unset P4USER
	    ;;
	*)  export P4USER=$1
	    ;;
	esac
    }
fi