Imported from archive.
[mudpy.git] / muff
diff --git a/muff b/muff
new file mode 100755 (executable)
index 0000000..57874d4
--- /dev/null
+++ b/muff
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+"""Skeletal executable for the MUFF Engine"""
+
+# Copyright (c) 2005 mudpy, Jeremy Stanley <fungi@yuggoth.org>, all rights reserved.
+# Licensed per terms in the LICENSE file distributed with this software.
+
+# muff uses the ini-style configs supported by the ConfigParser module
+import ConfigParser
+
+# need the sys module to alter the import path appropriately
+import sys
+
+def get_main_loop():
+       """Find and return the main loop function"""
+
+       # figure out where to find our main configuration file
+       config_data = ConfigParser.SafeConfigParser()
+       config_dirs = [".", "./etc", "/usr/local/muff", "/usr/local/muff/etc", "/etc/muff", "/etc" ]
+       config_name = "muff.conf"
+       config_files = []
+       for each_dir in config_dirs:
+               config_files.append(each_dir + "/" + config_name)
+
+       # load the config file, get the module path and add it to sys.path
+       config_data.read(config_files)
+       module_path = config_data.get("files", "modules")
+       sys.path.append(module_path)
+
+       # import the main loop function
+       from muff.muffmain import main
+       return main
+
+# load the main loop and run it
+main = get_main_loop()
+main()
+