X-Git-Url: https://git.donarmstrong.com/?p=infobot.git;a=blobdiff_plain;f=infobot;h=ffc3911387e33b9bd2554d97e8704b0e9257091d;hp=7fc8989620ba232a27501471b6ebb4502ede2bd2;hb=HEAD;hpb=40f6dad8bfd5a8a707a69cb31ba62cc6d26139c1 diff --git a/infobot b/infobot index 7fc8989..ffc3911 100755 --- a/infobot +++ b/infobot @@ -1,9 +1,9 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w # infobot # copyright kevin lenzo (c) 1997-1999 # copyright david sobon (c) 1999-infinity -# Copyright (c) 2001-2008 Tim Riker +# Copyright (c) 2001-2014 Tim Riker use strict; use vars qw($bot_base_dir $bot_src_dir $bot_misc_dir $bot_state_dir @@ -11,6 +11,11 @@ use vars qw($bot_base_dir $bot_src_dir $bot_misc_dir $bot_state_dir $bot_pid $memusage %param ); +# ancient Perl may not like these, but modern systems should have this +use open ':utf8'; +use open ':std'; +use Encode qw( decode FB_QUIET ); + BEGIN { if ( @ARGV and -f $ARGV[0] ) { @@ -19,17 +24,22 @@ BEGIN { } # 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_base_dir ||= `pwd`; + chomp($bot_base_dir); + $bot_config_dir ||= "$bot_base_dir/files/"; + $bot_data_dir ||= "$bot_base_dir/files/"; + $bot_state_dir ||= "$bot_base_dir/files/"; + $bot_run_dir ||= "$bot_base_dir"; $bot_src_dir ||= "$bot_base_dir/src"; $bot_log_dir ||= "$bot_base_dir/log"; - $bot_misc_dir ||= "$bot_base_dir/files"; + $bot_misc_dir ||= "$bot_base_dir/files"; $bot_pid = $$; + $bot_base_dir = $bot_state_dir; + + unshift @INC,"$bot_src_dir","$bot_src_dir/Modules"; + require "$bot_src_dir/logger.pl"; require "$bot_src_dir/core.pl"; require "$bot_src_dir/modules.pl"; @@ -104,5 +114,3 @@ sub duperuncheck { } 1; - -# vim:ts=4:sw=4:expandtab:tw=80