7 from optparse import OptionParser
8 from ConfigParser import SafeConfigParser
10 # first off, parse the command line arguments
12 oparser = OptionParser()
14 "-c", "--conf", dest="conf",
15 help="location of config file"
18 (options, args) = oparser.parse_args()
20 # check for the configfile
24 if options.conf != None:
25 # does the file exist?
28 configfile = options.conf
30 # should exit here as the specified file doesn't exist
31 sys.stderr.write("Config file %s does not exist. Exiting.\n" %(options.conf,))
34 # check through the default locations
36 os.stat("%s/.rss2maildir.conf" %(os.environ["HOME"],))
37 configfile = "%s/.rss2maildir.conf" %(os.environ["HOME"],)
40 os.stat("/etc/rss2maildir.conf")
41 configfile = "/etc/rss2maildir.conf"
43 sys.stderr.write("No config file found. Exiting.\n")
46 # Right - if we've got this far, we've got a config file, now for the hard
49 scp = SafeConfigParser()
52 maildir_root = "RSSMaildir"
54 if scp.has_option("general", "maildir_root"):
55 maildir_root = scp.get("general", "maildir_root")
57 feeds = scp.sections()
59 feeds.remove("general")
65 print "-" * len(section)
66 print scp.items(section)