aboutsummaryrefslogtreecommitdiff
path: root/net-im/jabberd/files/patch-tools-jabberd.in
blob: ae11dd7d64db993b7b083d7b88e21b4ffffb4802 (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
43
44
45
46
47
48
49
50
51
52
53
--- tools/jabberd.in.orig	2008-05-22 17:36:30.000000000 +0200
+++ tools/jabberd.in	2008-06-20 13:24:34.000000000 +0200
@@ -1,9 +1,4 @@
-#!/bin/sh
-#-*-Perl-*-
-
-exec perl -w -x $0 "$@"
-
-#!perl
+#!%%PERL%%
 
 ##############################################################################
 #
@@ -27,8 +22,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();
@@ -42,13 +36,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});
@@ -113,6 +114,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");
 }
 
 #-----------------------------------------------------------------------------