Allow conmux to pick up from local configuration file
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1178 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/conmux/Conmux.pm b/conmux/Conmux.pm
index 47b8cd2..343d3e0 100644
--- a/conmux/Conmux.pm
+++ b/conmux/Conmux.pm
@@ -11,11 +11,22 @@
#
package Conmux;
use URI::Escape;
+use File::Basename;
+use Cwd 'abs_path';
our $Config;
BEGIN {
+ my $abs_path = abs_path($0);
+ my $dir_path = dirname($abs_path);
+
my $cf = '/usr/local/conmux/etc/config';
+ if (-e "$dir_path/etc/config") {
+ $cf = "$dir_path/etc/config";
+ } elsif (-e "$dir_path/../etc/config") {
+ $cf = "$dir_path/../etc/config";
+ }
+
if (-f $cf) {
open(CFG, "<$cf") || die "Conmux: $cf: open failed - $!\n";
while(<CFG>) {