diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-23 21:06:28 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-23 21:07:21 (EDT) |
commit | 1e585cbb9208305d683c04d9e3e2eff0834117fd (patch) | |
tree | 3dafc80768a1ae207c39ca2e50aa516b3088731e | |
parent | a2267f9838b661d4cf75019d6301ab2627524af6 (diff) |
parse_control(): Make req_fields arg optional
-rw-r--r-- | src/control.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/control.sh b/src/control.sh index 04a4c2d..6a92ff3 100644 --- a/src/control.sh +++ b/src/control.sh @@ -42,7 +42,9 @@ parse_control() local file="${1}" local field_cb="${2}" local paragraph_cb="${3}" - local req_fields="${4}" + shift 3 + local check_fields= + local req_fields= local line_nr= local in_paragraph= local line= @@ -51,6 +53,13 @@ parse_control() local name= local value= + check_fields='false' + if [ ${#} -eq 1 ]; then + req_fields="${1}" + shift 1 + check_fields='true' + fi + line_nr=0 in_paragraph='false' |