summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-04-23 17:26:50 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-04-23 17:26:50 (EDT)
commita2267f9838b661d4cf75019d6301ab2627524af6 (patch)
treee57b736ba1012a1cee0692d9f3d444ae237dbafd
parent86ae9bb68973165682b7ee23743ab6c790cefbc2 (diff)
parse_control(): Convert to [ -n and -z operators
-rw-r--r--src/control.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/control.sh b/src/control.sh
index 2a7634d..04a4c2d 100644
--- a/src/control.sh
+++ b/src/control.sh
@@ -64,7 +64,7 @@ parse_control()
# initialization code (see heredocument
# below).
in_paragraph='false'
- if [ "x${name}" != 'x' ]; then
+ if [ -n "${name}" ]; then
if ! "${field_cb}" "${name}" \
"${value}"; then
return 0
@@ -73,7 +73,7 @@ parse_control()
if ! "${paragraph_cb}"; then
return 0
fi
- if [ "x${para_req_fields}" != 'x' ]; then
+ if [ -n "${para_req_fields}" ]; then
para_req_fields="$(printf \
"%s$(get_msg \
'list_item_separator')"\
@@ -94,7 +94,7 @@ parse_control()
;;
[!\ ]*':'*) # "Name: Value" line.
in_paragraph='true'
- if [ "x${name}" != 'x' ]; then
+ if [ -n "${name}" ]; then
if ! "${field_cb}" "${name}" "${value}"
then
return 0
@@ -103,12 +103,12 @@ parse_control()
IFS=': ' read name value <<-EOF
${line}
EOF
- if [ "x${name}" = 'x' ]; then
+ if [ -z "${name}" ]; then
_parse_control_error "${file}" \
"${line_nr}" 'control_bad_nv'
continue
fi
- if [ "x${para_req_fields}" != 'x' ]; then
+ if [ -n "${para_req_fields}" ]; then
# Remove field from list of required
# fields.
para_req_fields="$(printf '%s' \
@@ -128,7 +128,7 @@ parse_control()
;;
' '*) # Continuation line.
in_paragraph='true'
- if [ "x${name}" = 'x' ]; then
+ if [ -z "${name}" ]; then
# Expecting a "Name: Value" line.
_parse_control_error "${file}" \
"${line_nr}" \
@@ -148,7 +148,7 @@ parse_control()
# The second blank line above is needed because the command substitution
# removes any trailing newlines.
- if [ "x${name}" != 'x' ]; then
+ if [ -n "${name}" ]; then
if ! "${field_cb}" "${name}" "${value}"; then
return 0
fi