better reporting of invalid configuration files

This commit is contained in:
Radovan Garabík 2015-12-25 15:47:36 +01:00
parent 7a48f0d91e
commit 0ae0ce08a8
2 changed files with 8 additions and 2 deletions

1
grc
View File

@ -103,7 +103,6 @@ if cfile != "" and colour:
if stderrff:
choe, chie = os.pipe()
pidp = os.fork()
if pidp == 0: # child
if stdoutff:

9
grcat
View File

@ -119,7 +119,14 @@ while not is_last:
continue
if not l[0] in letters:
break
keyword, value = split(l[:-1], "=", 1)
fields = split(l[:-1], "=", 1)
if len(fields) != 2:
sys.stderr.write('Error in configuration, I expect keyword=value line\n')
sys.stderr.write('But I got instead:\n')
sys.stderr.write(repr(l))
sys.stderr.write('\n')
sys.exit(1)
keyword, value = fields
keyword = lower(keyword)
if keyword in ('colors', 'colour', 'color'):
keyword = 'colours'