Doesn't write to ${BOOTLOG} what was actually skipped

I have added an "_" to the beginning of the corrected function name so I can test the results.

Remove it to replace  log_skip_msg() in init_functions

log_skip_msg()
{
    /bin/echo -n -e "${BMPREFIX}${@}"
    /bin/echo -e "${CURS_ZERO}${SKIP_PREFIX}${SET_COL}${SKIP_SUFFIX}"
    # Strip non-printable characters from log file
    logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
    /bin/echo "SKIP" >> ${BOOTLOG}
    return 0

Corrected:

function _log_skip_msg {
    local msg="${*}"
    timespec
    printf "${BMPREFIX}${msg}"
    printf "${CURS_ZERO}${SKIP_PREFIX}${SET_COL}${SKIP_SUFFIX}"
    #    Strip non-printable characters from log file
    #    ${string//substring/replacement}
    msg=${msg//\\033[1A}        #CURS_UP
    msg=${msg//\\033[0G}        #CURS_ZERO
    msg=${msg//\\033[${COL}G}    #SET_COL
    msg=${msg//\\033[?;??m}        #COLOUR CODES
    printf "%s" "${STAMP}: ${msg}" >> "${BOOTLOG}"
    return 0
}


Test script:

msg="log_skip_msg"
#function log_skip_msg
_msg "function ${msg}"
    log_skip_msg "${msg}: ${BRACKET}test";evaluate_retval
_msg "function ${msg}"

_msg "function _${msg}"
    _log_skip_msg "_${msg}: ${INFO}test";evaluate_retval
_msg "function _${msg}"

Results:

lfs function writes this to ${BOOTLOG}

SKIP
 OK

Corrected function writes this to ${BOOTLOG}

Mar 30 10:42:45 -04:00 scott.example.org: _log_skip_msg: test SKIP OK

The extra "OK" is from evaluate_retval

--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to