]> git.donarmstrong.com Git - infobot.git/blobdiff - infobot
* Use Don's patch to allow leading and trailing spaces in the server list
[infobot.git] / infobot
diff --git a/infobot b/infobot
index e53ed5b6d1d7c447b30570b1aac599cd096c468d..4ef62d5f1dfe4128bc441c6516c857cc773ca5d8 100755 (executable)
--- a/infobot
+++ b/infobot
@@ -1,27 +1,35 @@
 #!/usr/bin/perl
 
-# infobot -- copyright kevin lenzo (c) 1997-infinity
-# no warrantee expressed or implied. terms as the 
-# license for X11R6 when needed.
+# infobot  -- copyright kevin lenzo (c) 1997-1999
+# blootbot -- copyright david sobon (c) 1999-infinity
 
 use strict;
-use vars qw($infobot_base_dir $infobot_src_dir $infobot_misc_dir
-           $infobot_pid $memusage %param
+use vars qw($bot_base_dir $bot_src_dir $bot_misc_dir $bot_state_dir
+           $bot_data_dir $bot_config_dir $bot_log_dir $bot_run_dir
+           $bot_pid $memusage %param
 );
 
 BEGIN {
-    # set this to the absolute path if you need it; especially
-    # if . is not in your path
+    if (@ARGV and -f $ARGV[0]) {
+       # source passed config to allow $bot_*_dir to be set.
+       do $ARGV[0];
+    }
+
+    # set any $bot_*_dir var's that aren't already set
+    $bot_base_dir      ||= '.';
+    $bot_config_dir    ||= 'files/';
+    $bot_data_dir      ||= 'files/';
+    $bot_state_dir     ||= 'files/';
+    $bot_run_dir       ||= '.';
+    $bot_src_dir       ||= "$bot_base_dir/src";
+    $bot_log_dir       ||= "$bot_base_dir/log";
+    $bot_misc_dir      ||= "$bot_base_dir/files";
 
-    $infobot_base_dir  = '.';
-    $infobot_src_dir   = "$infobot_base_dir/src";
-    $infobot_misc_dir  = "$infobot_base_dir/files";
-    $infobot_pid       = $$;
+    $bot_pid           = $$;
 
-    require "$infobot_src_dir/logger.pl";
-    require "$infobot_src_dir/core.pl";
-    require "$infobot_src_dir/interface.pl";
-    require "$infobot_src_dir/modules.pl";
+    require "$bot_src_dir/logger.pl";
+    require "$bot_src_dir/core.pl";
+    require "$bot_src_dir/modules.pl";
 
     # load the configuration (params) file.
     &setupConfig();
@@ -39,7 +47,7 @@ BEGIN {
 # prevent duplicate processes of the same bot
 &duperuncheck();
 
-# initialize everything 
+# initialize everything
 &startup();    # first time initialization.
 &setup();
 
@@ -54,9 +62,7 @@ exit 0;  # just so you don't look farther down in this file :)
 
 # --- support routines
 
-# FIXME.
-#   add arguments, basically '-h' and '--help', heh.
-#
+# FIXME: add arguments, basically '-h' and '--help', heh.
 
 # added by the xk
 sub duperuncheck {