diff options
-rw-r--r-- | lib/control.sh | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/lib/control.sh b/lib/control.sh index 30c6b9c..c5ed645 100644 --- a/lib/control.sh +++ b/lib/control.sh @@ -19,35 +19,6 @@ _OB_SUBSTVARS_MAX_DEPTH=50 -_ob_parse_control_error() -{ - local file= - local line_nr= - local msg_id= - local file_info= - local orig_text_domain= - - file="${1}" - line_nr="${2}" - msg_id="${3}" - shift 3 - - if [ ${line_nr} -eq 0 ]; then - file_info="$(printf '%20s:' "${file}")" - else - file_info="$(printf '%20s(l%d):' "${file}" "${line_nr}")" - fi - - orig_text_domain="$(ob_get_text_domain)" - ob_set_text_domain "${_OB_INTERNAL_TEXT_DOMAIN}" - - ob_warn "${file_info} $(ob_get_msg "${msg_id}")" "${@}" - - ob_set_text_domain "${orig_text_domain}" - - return 0 -} - ## @brief Parse a control file ## @details \fBob_parse_control\fP parses a control file of field names and ## values formatted like RFC 822 (or RFC 2822 or RFC 5322) headers. @@ -113,7 +84,7 @@ ob_parse_control() line_nr=$(($line_nr + 1)) case "${line}" in '') - _ob_parse_control_error "${file}" "${line_nr}" \ + _ob_run_parse_error_cb "${file}" "${line_nr}" \ 'control_empty_line' ;; '#'*) # Comment. @@ -129,7 +100,7 @@ ob_parse_control() EOF if [ -z "${name}" ]; then # Badly formatted control field. - _ob_parse_control_error "${file}" "${line_nr}" \ + _ob_run_parse_error_cb "${file}" "${line_nr}" \ 'control_bad_nv' continue fi @@ -137,7 +108,7 @@ ob_parse_control() if [ "${all_fields% ${name} *}" = \ "${all_fields}" ]; then # Unknown field. - _ob_parse_control_error \ + _ob_run_parse_error_cb \ "${file}" "${line_nr}" \ 'control_unknown_field' "${name}" else @@ -149,7 +120,7 @@ ob_parse_control() if [ "${got_fields% ${name} *}" != \ "${got_fields}" ]; then # Duplicate field. - _ob_parse_control_error "${file}" "${line_nr}" \ + _ob_run_parse_error_cb "${file}" "${line_nr}" \ 'control_duplicate_field' "${name}" else got_fields="${got_fields}${name} " @@ -158,7 +129,7 @@ ob_parse_control() ' '*) # Continuation line. if [ -z "${name}" ]; then # Expecting a "Name: Value" line. - _ob_parse_control_error "${file}" "${line_nr}" \ + _ob_run_parse_error_cb "${file}" "${line_nr}" \ 'control_found_continuation' continue fi @@ -182,7 +153,7 @@ ob_parse_control() # Missing required control fields. req_fields="$(echo "${req_fields}" | sed 's/ / /g' | \ sed "s/ /$(ob_get_msg 'list_item_separator')/g")" - _ob_parse_control_error "${file}" '0' \ + _ob_run_parse_error_cb "${file}" '0' \ 'control_missing_fields' "${req_fields}" fi fi |