Commit 7f719a83 authored by Vitaly Lipatov's avatar Vitaly Lipatov

common: add print_message and use it in fatal and warning. Print only script…

common: add print_message and use it in fatal and warning. Print only script name, not absolute path
parent 92e8649c
...@@ -11,25 +11,28 @@ realpath() ...@@ -11,25 +11,28 @@ realpath()
readlink -f "$@" readlink -f "$@"
} }
# Print error message and stop the program print_message()
fatal()
{ {
local DESC="$1"
shift
if [ -z "$TEXTDOMAIN" ] ; then if [ -z "$TEXTDOMAIN" ] ; then
echo "Error in $0: $@" >&2 echo "$DESC in $(basename $0): $@" >&2
else else
echog "Error in $0: $@" >&2 echog "$DESC in $(basename $0): $@" >&2
fi fi
}
# Print error message and stop the program
fatal()
{
print_message Error "$@"
exit 1 exit 1
} }
# Just print warning message # Just print warning message
warning() warning()
{ {
if [ -z "$TEXTDOMAIN" ] ; then print_message Warning "$@"
echo "Warning in $0: $@" >&2
else
echog "Warning in $0: $@" >&2
fi
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment