Fix being able to pipe an INI into the parser.

This commit is contained in:
Darren 'Tadgy' Austin 2019-08-12 00:41:22 +01:00
commit ca00b03cb7

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Bash INI file parser v0.1.0. # Bash INI file parser v0.1.1.
# Copyright (C) 2019 Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>. # Copyright (C) 2019 Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>.
# Licensed under the terms of the GNU General Public Licence version 3. # Licensed under the terms of the GNU General Public Licence version 3.
# #
@ -115,6 +115,7 @@ parser_getopts() {
return 2 return 2
;; ;;
--) --)
shift
break break
;; ;;
--*|-*) --*|-*)
@ -281,7 +282,7 @@ parse_ini() {
# If reading from stdin, don't try to open the FD as it's already open. # If reading from stdin, don't try to open the FD as it's already open.
if [[ "$INIFILE" == "-" ]]; then if [[ "$INIFILE" == "-" ]]; then
INIFD="1" INIFD="0"
else else
# File accessability checks. # File accessability checks.
if [[ ! -e "$INIFILE" ]]; then if [[ ! -e "$INIFILE" ]]; then