From: Michael Gebetsroither Date: Tue, 13 Dec 2005 15:00:26 +0000 (+0100) Subject: added hook to enable debug like DEBUG=1; ./programm X-Git-Tag: 1.02.06~6 X-Git-Url: http://git.grml.org/?p=grml-shlib.git;a=commitdiff_plain;h=351376b85f7689b56cba6b93bc1fdbc90fea127c added hook to enable debug like DEBUG=1; ./programm --- diff --git a/TODO b/TODO index 8c8ed84..e999723 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,5 @@ * service{Start,Stop,Restart} * wrapper arround pgrep - * function to set C environment (lang) - * debug over function (setdebug), von außen DEBUG=x 1:1 übersetzung nach verbose - * paket umbenennen nach grml-shlib * execute (secureInput verbessern) @mika * getUserName (is this user available on this system) * update relToAbs (readlink -f) diff --git a/sh-lib b/sh-lib index 53244ac..06c66b5 100644 --- a/sh-lib +++ b/sh-lib @@ -51,6 +51,9 @@ function unsetVerbose { VERBOSE_TMP__=$VERBOSE__; VERBOSE__=0; } function restoreVerbose { VERBOSE__=$VERBOSE_TMP__; } function getVerbose { echo "$VERBOSE__"; } +function setDebug { setVerbose "$DPRINT__"; } +function unsetDebug { restoreVerbose; } + function setExitFunction { EXIT_FUNCTION__="$1"; } function resetExitFunction { EXIT_FUNCTION__="_syslog"; } # }}} @@ -644,6 +647,14 @@ function _checkBootParam return 1 } _checkBootParam + + +function _setDebugLevel +{ + local debug_="${DEBUG:-0}" + VERBOSE__="$debug_" +} +_checkBootParam # }}} # END OF FILE