TPUT="${TPUT:-"/usr/bin/tput"}"
-have_tput() {
+_have_tput() {
[ -x "$TPUT" ] && "$TPUT" hpa 60 >/dev/null 2>&1 \
&& return 0 \
|| return 1
}
log_failure_msg () {
- if have_tput ; then
+ if _have_tput ; then
RED="$("$TPUT" setaf 1)"
#NORMAL="$("$TPUT" op)"
printf " ${RED}*${NORMAL} $@\n"
}
log_warning_msg () {
- if have_tput ; then
+ if _have_tput ; then
YELLOW="$("$TPUT" setaf 3)"
#NORMAL="$("$TPUT" op")"
# printf " *${NORMAL} $@\n"
}
log_warning_msg_nn () {
- if have_tput ; then
+ if _have_tput ; then
YELLOW="$("$TPUT" setaf 3)"
printf " ${BLUE}*${NORMAL} $@"
else
# Only do the fancy stuff if we have an appropriate terminal
# and if /usr is already mounted
- if have_tput ; then
+ if _have_tput ; then
COLS="$("$TPUT" cols)"
if [ -n "$COLS" ]; then
COL=$(( "$COLS" - 7 ))
return ${retval}
}
-# Safer way to list the contents of a directory,
-# as it do not have the "empty dir bug".
-#
-# char *dolisting(param)
-#
-# print a list of the directory contents
-#
-# NOTE: quote the params if they contain globs.
-# also, error checking is not that extensive ...
-#
-dolisting() {
- local x
- local y
- local tmpstr
- local mylist
- local mypath="$*"
-
- if [ "${mypath%/\*}" != "${mypath}" ]
- then
- mypath="${mypath%/\*}"
- fi
-
- for x in ${mypath}
- do
- [ ! -e "${x}" ] && continue
-
- if [ ! -d "${x}" ] && ( [ -L "${x}" ] || [ -f "${x}" ] )
- then
- mylist="${mylist} $(ls "${x}" 2> /dev/null)"
- else
- [ "${x%/}" != "${x}" ] && x="${x%/}"
-
- cd "${x}"; tmpstr="$(ls)"
-
- for y in ${tmpstr}
- do
- mylist="${mylist} ${x}/${y}"
- done
- fi
- done
-
- printf "${mylist}\n"
-}
-
# char *add_suffix(char * configfile)
#
# Returns a config file name with the softlevel suffix