From: Matei David Date: Fri, 8 May 2015 16:37:52 +0000 (-0400) Subject: smailq: Look for global configuration under /etc X-Git-Tag: v1.2~7 X-Git-Url: https://git.sthu.org/?p=smailq.git;a=commitdiff_plain;h=4fbe052b37ddedb7ae917916f6670ce6242e3b01;hp=8ca9634bd86f815ec538960fe81f6ef7b16aa567 smailq: Look for global configuration under /etc Signed-off-by: Stefan Huber --- diff --git a/smailq b/smailq index def0a0a..d719d43 100755 --- a/smailq +++ b/smailq @@ -395,7 +395,7 @@ OPTIONS: if __name__ == "__main__": - conffn = os.path.expanduser("~/.smailq.conf") + conffn_list = [os.path.expanduser("~/.smailq.conf"), "/etc/smailq.conf"] cmd = "--list" nooptargs = [] @@ -416,7 +416,7 @@ if __name__ == "__main__": '--deliver']: cmd = opt elif opt in ['-C', '--config']: - conffn = arg + conffn_list = [arg] elif opt in ['-v', '--verbose']: verbose = True quiet = False @@ -432,8 +432,9 @@ if __name__ == "__main__": sys.exit(os.EX_USAGE) # Reading config file - if not os.path.isfile(conffn): - printerr("No such config file:", conffn) + conffn = next((f for f in conffn_list if os.path.isfile(f)), None) + if conffn is None: + printerr("No config file found: " + str(conffn_list)) sys.exit(os.EX_IOERR) conf = None try: