#!/bin/sh #---------------------------------------------------------------------------- # /var/install/include/mecho - multi echo # # Copyright (c) 2004 Frank Meyer # # Creation: 22.07.20004 fm # 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. #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- # usage #---------------------------------------------------------------------------- # # mecho [-n] [-std|-info|-warn|-error] [-tty|-html|-file] message ... # # options: # -n do not append newline # # -std print standard message (default) # -info print info message # -warn print warning message # -error print error message # # -tty use console colors # -html use html tags for colors # -file don't use any color tags # #---------------------------------------------------------------------------- #============================================================================ # main #============================================================================ mecho () { _mecho_opt='STD' _mecho_mode="$_EISLIB_PRINTMODE" _mecho_flags='' _mecho_colors='' while [ 1 ] do case "$1" in -n) _mecho_flags='-n'; shift;; -std) _mecho_opt='STD'; shift;; -info) _mecho_opt='INFO'; shift;; -warn) _mecho_opt='WARN'; shift;; -error) _mecho_opt='ERROR'; shift;; -tty) _mecho_mode='tty'; shift;; -html) _mecho_mode='html'; shift;; -file) _mecho_mode='file'; shift;; *) break;; esac done case $_mecho_mode in tty) eval _mecho_colors='$'_EISLIB_COLOR_TTY_${_mecho_opt} colecho_tty $_mecho_flags "$*" $_mecho_colors ;; html) eval _mecho_colors='$'_EISLIB_COLOR_HTML_${_mecho_opt} colecho_html "$*" $_mecho_colors ;; file) echo $_mecho_flags "$*" ;; esac } #============================================================================ # end #============================================================================