# Copyright (c) 2002-2003 SuSE Linux AG Nuernberg, Germany.
# All rights reserved.
#
# 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
#
# Authors: Michal Svec <msvec@suse.cz>
#          Mads Martin Joergensen <mmj@suse.de>
#

#####################################################################
# Returnvalues
#
# I don't know currently, if all this returnvalues are necessary. Probably some
# of them will be removed. The values 0-7 should be very similar to the LSB
# return values for init scripts
R_SUCCESS=0        # interface has been set up
R_ERROR=1          # any unspecified error
R_USAGE=2          # wrong usage
R_NOTIMPL=3        # feature not implemented
R_NOTALLOWED=4     # insufficient privilege
R_NODEV=7          # the given interface does not exist
R_NOTCONFIGURED=5  # the bootmode does not match the current mode
R_INACTIVE=5       # the interface is not up and it should not
R_NOTRUNNING=7     # the interface is not up but it should be up

R_NOCONFIG=9       # we could not find a matching configuration file
R_INTERNAL=$R_ERROR      # internal error, e.g. no config or missing scripts

PATH=/sbin:/usr/sbin:/bin:/usr/bin:${SYSCONFIG}/scripts/common

error () {
	warning "$@"
	exit $R_ERROR
}

warning () {
	test "$DEBUG" = "yes" && echo -e "$SCRIPTNAME $*" >&2 && return
	test -z "$*" && return
	echo -e "$*" >&2
}

message () {
	test "$DEBUG" = "yes" && echo -e "$SCRIPTNAME $*" && return
	test "$BE_QUIET" = "yes" && return
	test -z "$*" && return
	echo -e "$*"
}

message_n () {
	test "$DEBUG" = "yes" && echo -en "$SCRIPTNAME $*" && return
	test "$BE_QUIET" = "yes" && test "$DEBUG" != "yes" && return
	echo -en "$*"
}

debug () {
	test "$DEBUG" != "yes" && return
	test -z "$*" && return
	echo -e "$SCRIPTNAME [DEBUG] $*"
}

