head	1.2;
access;
symbols
	VER_0_3:1.2
	VER_0_2:1.1;
locks; strict;
comment	@# @;


1.2
date	95.03.24.11.43.35;	author coulter;	state Exp;
branches;
next	1.1;

1.1
date	95.02.18.08.36.38;	author coulter;	state Exp;
branches;
next	;


desc
@standard ksh functions.  sourced in by various scripts
@


1.2
log
@Checkin version for 0.3 distribution.
@
text
@
# (C) Copyright 1995 by Michael Coulter.  All rights reserved.
##########################################################################
# Functions:
    # check_return expected_value exit_value exit_message
    # check_cmd function: check_cmd exit_status cmd arg...
    # report_error expected_status message

    # USAGE: check_return expected_value exit_value exit_message
    function check_return
    {
	RETURN_STATUS=$?
	if [ "$RETURN_STATUS" -ne "$1" ]
	then
	    echo "Expected status $1 got ${RETURN_STATUS}." >&2
	    echo "$3" >&2
	    exit "$2"
	fi
    }

    # check_cmd function: check_cmd exit_status cmd arg...
    #
    function check_cmd
    {
        EXIT_STATUS="$1"; shift
        COMMAND="$@@"
        "$@@"
        check_return 0 "$EXIT_STATUS" "Error with command: $COMMAND"
    }

    #   report_error expected_status message
    #		if $? is not expecte_status, print message to stderr and
    #		increment NBR_ERRORS
	function report_error
	{
	    REPORT_ERROR_STATUS=$?
	    if [ $REPORT_ERROR_STATUS -ne "$1" ]
	    then
		echo "$2" >&2
		NBR_ERRORS=$$(($NBR_ERRORS + 1))
	    fi
	}
	NBR_ERRORS=0
@


1.1
log
@Checkpoint version before fixing /usr/bin install
@
text
@d2 1
@
