|
From: Masque <qi...@us...> - 2005-08-08 00:25:05
|
Update of /cvsroot/infobot/infobot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23035 Modified Files: infobot Log Message: Bringing CVS in line with that which is running as purl. Previous version tagged as 'oscon2005' for no particular reason other than date. Index: infobot =================================================================== RCS file: /cvsroot/infobot/infobot/infobot,v retrieving revision 1.15 retrieving revision 1.16 diff -w -u -r1.15 -r1.16 --- infobot 2 Aug 2004 20:37:20 -0000 1.15 +++ infobot 8 Aug 2005 00:24:23 -0000 1.16 @@ -1,16 +1,19 @@ #!/usr/bin/perl # infobot -- copyright kevin lenzo (c) 1997-infinity +# Flooterbuck Infobot -- copyright (C) Dave Brown, 2001-2004 -# no warrantee expressed or implied. terms as the -# license for X11R6 when needed. +# For full licensing terms see the file LICENSE included with +# the flooterbuck distribution. + +require 5.6.0; BEGIN { - $VER_MAJ = 0; - $VER_MIN = 45; - $VER_MOD = 3; + $VER_MAJ = 1; + $VER_MIN = 2; + $VER_MOD = 1; - $version = "infobot $VER_MAJ\.$VER_MIN\.$VER_MOD [Wurm]"; + $version = "Flooterbuck infobot $VER_MAJ\.$VER_MIN\.$VER_MOD [dagbrown]"; } BEGIN { @@ -18,16 +21,13 @@ # set this to the absolute path if you need it; especially # if . is not in your path - # - # XXX I don't have . in my path and I haven't had problems, what - # does this comment mean? -Roderick $param{'basedir'} = ($0 =~ /(.*)$filesep/) ? $1 : '.'; # $infobot_base_dir = '/usr/local/lib/infobot'; # change this next line if you run a local instance of # an infobot and use the code from the main location. - # the 'conf' directory contains infobot.config and + # the 'files' directory contains infobot.config and # infobot.users, among other things. $param{'confdir'} = "$param{basedir}${filesep}conf"; @@ -37,41 +37,15 @@ # is why all these requires are here. $param{'srcdir'} = $param{'basedir'}.$filesep."src"; -} -# Add the source dir to @INC before loading the *.pl files so that they -# can use the modules there. -use lib $param{'srcdir'}; - -BEGIN { opendir DIR, $param{'srcdir'} or die "can't open source directory $param{srcdir}: $!"; - # Sort the files to ensure they get loaded in the same order for - # everybody. The inspiration is that the code worked for me but - # failed for a user because for me DBM.pl was loaded before - # Process.pl. This simple sort fixes that particular problem - # and will at least prevent problems from happening only to some - # people. The sort is case-insensitive so that the results will - # be the same on case-forgiving filesystems. For better control - # one could use artifically low-sorting file names, or invent - # something more elaborate. - for my $file (sort { lc $a cmp lc $b } readdir DIR) { + while ($file = readdir DIR) { next unless $file =~ /\.pl$/; require "$param{srcdir}$filesep$file"; } closedir DIR; - - $param{'extradir'} = $param{'basedir'}.$filesep."extras"; - - opendir DIR, $param{'extradir'} - or die "can't open extras directory $param{extradir}: $!"; - - for my $file (sort { lc $a cmp lc $b } readdir DIR) { - next unless $file =~ /\.pl$/; - require "$param{extradir}$filesep$file"; - } - closedir DIR; } # get the command line arguments @@ -80,29 +54,6 @@ # initialize everything &setup(); -# daemonise if needed -if ($daemon) { - - require Cwd; - - $pid_file = &Cwd::cwd . "/$param{'ident'}.pid"; - - if (-e $pid_file) { - die "$pid_file lockfile exists. Please remove to run infobot as a daemon"; - } - - print "\nChanging to a background process:\n"; - print "PID saved in $pid_file\n"; - - &Proc::Daemon::Init; - - open(PIDFILE, ">$pid_file")||print "Couldn't open $pid_file for writing\n"; - print PIDFILE "$$\n"; - close PIDFILE; - -} - - # launch the irc event loop &irc(); @@ -113,39 +64,41 @@ sub usage { print "\n"; - print " usage: $0 [-h] [<paramfile1> [<pf2> ...]]\n"; + print " usage: $0 [-h] [<config file>]\n"; print "\n"; print " -h this message\n"; print "\n"; } sub getArgs { - if (@ARGV) { - while (@ARGV) { - my $arg = shift @ARGV; - if ($arg =~ s/^-//) { - # switchies - if ($arg eq 'i') { - # go into irc mode despite db setting - $overrideMode = 'IRC'; - } elsif ($arg eq 'd') { - eval "require Proc::Daemon"; - if ($@) { die "Proc::Daemon must be installed to run this as a background process"; } - $daemon++; - } else { - # -h is in here by default + if ($ARGV[0]) { + if ($ARGV[0] =~ /^-[hi\?]/) { &usage; - exit(1); + exit 1; } - } else { - # no switchie. currently assumed to be - # a paramfile by default - push @paramfiles, $arg; + else { + $paramfile = $ARGV[0] } } - } else { - @paramfiles = (); + else { + $paramfile = ''; } } 1; + +__END__ + +=head1 NAME + +Flooterbuck Infobot - a modular IRC information bot + +=head1 SYNOPSIS + +B<infobot> S<[ -h ]> [I<paramfile1> [I<paramfile2> ...]] + +=head1 NOTE + +If you're reading this, you need to yell at +Dave Brown (flo...@da...) +and tell him to write some actual documentation. =) |