aboutsummaryrefslogtreecommitdiff
path: root/net-im/jabberd/files/patch-tools-jabberd.in
blob: 00c37af3de79dc385b5e89793b9d509208e1c17a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- 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");
 }
 
 #-----------------------------------------------------------------------------