2 # (C) 2006-2011 Andre Noll
8 E_GSU_BAD_COMMAND invalid command
9 E_GSU_NOT_A_NUMBER not a number
10 E_GSU_BAD_CONFIG_VAR invalid config variable
11 E_GSU_NEED_VALUE value required but not given
12 E_GSU_BAD_BOOL bad value for boolian option
13 E_GSU_BAD_OPTION_TYPE invalid option type
14 E_GSU_BAD_ARG_COUNT invalid number of arguments
15 E_GSU_EDITOR failed to execute editor
16 E_GSU_MKDIR failed to create directory
17 E_GSU_GETOPTS getopts error
33 export -f _gsu_init_errors
35 # check if $1 is a number
39 if test "$1" -eq "$1" &> /dev/null; then
42 ret=-$E_GSU_NOT_A_NUMBER
45 export -f gsu_is_a_number
51 export -f gsu_short_msg
55 gsu_short_msg "$_gsu_self: $1"
61 gsu_short_msg "$_gsu_self $(date): $1"
63 export -f gsu_date_msg
67 local txt="$result" err
69 gsu_is_a_number "$ret"
70 if test $ret -lt 0; then
71 gsu_msg "unknown error ($ret:$txt)"
74 if test $result -ge 0; then
75 gsu_msg "unknown error ($result:$txt)"
79 if test -n "$txt"; then
80 txt="$txt: ${gsu_error_txt[$err]}"
82 txt="${gsu_error_txt[$err]}"
90 _gsu_self="$(basename $0)"
91 gsu_name="${gsu_name:=$_gsu_self}"
92 gsu_config_var_prefix="${gsu_config_var_prefix:=$gsu_name}"