#----------------------------------------------------------------------------
# /var/install/include/baselib - basic library for eisfair scripts
#
# Copyright (c) 2004 Frank Meyer <frank@eisfair(dot)org>
#
# Creation:     29.09.20004 max
# Last Update:  $Id$
#
# 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.
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
# interface description
#----------------------------------------------------------------------------
# 
# _EISLIB_BASELIB        is set to 'true' if this file is already included
#
# _EISLIB_PRINTMODE      is set to 'tty'  if output goes to a tty
#                        is set to 'html' if output goes to a webbrowser
#                        is set to 'file' if output is redirected to a file
#
# get_printmode()        echo the actual _EISLIB_PRINTMODE
#
#----------------------------------------------------------------------------


#============================================================================
# only include this file once
#============================================================================

if [ "$_EISLIB_BASELIB" != "true" ]
then

_EISLIB_BASELIB='true'


#============================================================================
# autodetect output: tty / html / file 
#============================================================================

if /usr/bin/tty -s <&1
then
    _EISLIB_PRINTMODE='tty'
else
    if [ "$GATEWAY_INTERFACE" != "" ]
    then
        _EISLIB_PRINTMODE='html'
    else
        _EISLIB_PRINTMODE='file'
    fi
fi


#============================================================================
# define colors
#============================================================================

_EISLIB_COLOR_TTY_STD=''
_EISLIB_COLOR_HTML_STD='b'

_EISLIB_COLOR_TTY_INFO='gn'
_EISLIB_COLOR_HTML_INFO='gn'

_EISLIB_COLOR_TTY_WARN='br b br'
_EISLIB_COLOR_HTML_WARN='br'

_EISLIB_COLOR_TTY_ERROR='rd w brinv'
_EISLIB_COLOR_HTML_ERROR='rd x br'

#============================================================================
# define basic functions
#============================================================================

get_printmode()
{
   echo $_EISLIB_PRINTMODE
}

#============================================================================
# end only include once
#============================================================================

fi


#============================================================================
# end
#============================================================================