summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/control.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/control.sh b/lib/control.sh
index b99a05c..3bcedbc 100644
--- a/lib/control.sh
+++ b/lib/control.sh
@@ -80,6 +80,7 @@ ob_parse_control()
local line=
local name=
local value=
+ local sep=
if [ ${#} -eq 3 ]; then
file="${1}"
@@ -173,15 +174,15 @@ ob_parse_control()
fi
if ${check_fields}; then
- req_fields="${req_fields## }"
- req_fields="${req_fields%% }"
- if [ -n "${req_fields}" ]; then
+ case "${req_fields}" in *[!\ ]*)
# Missing required control fields.
- req_fields="$(echo "${req_fields}" | sed 's/ / /g' | \
- sed "s/ /$(ob_get_msg 'list_item_separator')/g")"
+ sep="$(_ob_get_msg 'list_item_separator')"
+ req_fields="$(printf "%s${sep}" ${req_fields}; \
+ printf 'x')"
+ req_fields="${req_fields%${sep}x}"
_ob_parse_control_error "${file}" '0' \
'control_missing_fields' "${req_fields}"
- fi
+ esac
fi
return 0