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()
readlink -f "$@"
}
# Print error message and stop the program
fatal()
print_message()
{
local DESC="$1"
shift
if [ -z "$TEXTDOMAIN" ] ; then
echo "Error in $0: $@" >&2
echo "$DESC in $(basename $0): $@" >&2
else
echog "Error in $0: $@" >&2
echog "$DESC in $(basename $0): $@" >&2
fi
}
# Print error message and stop the program
fatal()
{
print_message Error "$@"
exit 1
}
# Just print warning message
warning()
{
if [ -z "$TEXTDOMAIN" ] ; then
echo "Warning in $0: $@" >&2
else
echog "Warning in $0: $@" >&2
fi
print_message Warning "$@"
}
......
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