ports/net-im/jabberd/files/patch-tools-jabberd.in
Pav Lucistnik 1917b94583 - Add a command line option -d to specify configuration directory
PR:		ports/102651
Submitted by:	Aaron Gifford <astounding@gmail.com>
Approved by:	Kirk Strauser <kirk@strauser.com> (maintainer)
2006-10-07 14:35:12 +00:00

42 lines
1.4 KiB
Text

--- tools/jabberd.in.orig Wed Jun 22 22:32:05 2005
+++ tools/jabberd.in Sat Oct 7 16:27:19 2006
@@ -28,8 +28,7 @@
my $Bin = "@bindir@";
my $VERSION = "@VERSION@";
my $config_dir = "@sysconfdir@";
-my $config = $config_dir."/jabberd.cfg";
-$config = "internal" unless (-e $config);
+my $config = "jabberd.cfg";
my $debug = 0;
my $daemon = 0;
my $select = IO::Select->new();
@@ -43,13 +42,20 @@
# Process the command line arguments
#-----------------------------------------------------------------------------
my %opts;
-getopts("c:Dhb",\%opts);
+getopts("c:d:Dhb",\%opts);
&usage if exists($opts{h});
if (exists($opts{c}))
{
$config = $opts{c} if (defined($opts{c}) && ($opts{c} ne ""));
&usage() if (!defined($opts{c}) || ($opts{c} eq ""));
}
+if (exists($opts{d}))
+{
+ $config_dir = $opts{d} if (defined($opts{d}) && ($opts{d} ne ""));
+ &usage() if (!defined($opts{d}) || ($opts{d} eq ""));
+}
+$config = $config_dir.'/'.$config if ($config !~ /^\//);
+$config = "internal" unless (-e $config);
$debug = 1 if exists($opts{D});
$daemon = 1 if exists($opts{b});
@@ -123,6 +129,7 @@
&debug("jabberd","stdout","debug on\n");
&debug("jabberd","stdout","version($VERSION)\n");
&debug("jabberd","stdout","config_dir($config_dir)\n");
+ &debug("jabberd","stdout","config($config)\n");
}
#-----------------------------------------------------------------------------