From 86c0a10044727dae98e0ccbd9aee475e8154c15f Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Thu, 8 Apr 2010 07:41:43 +0200 Subject: [PATCH] Add option '-c': define another .rcfile. Signed-off-by: Thomas Hochstein --- yapfaq.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/yapfaq.pl b/yapfaq.pl index 23f7e5a..c9a8098 100644 --- a/yapfaq.pl +++ b/yapfaq.pl @@ -62,7 +62,7 @@ my ($TDY, $TDM, $TDD) = Today(); #TD: Today's date # read commandline options my %Options; -getopts('Vhvpdt:f:s:', \%Options); +getopts('Vhvpdt:f:c:s:', \%Options); # -V: print version / copyright information if ($Options{'V'}) { print "$0 v $Version\nCopyright (c) 2003 Marc Brockschmidt \nCopyright (c) 2010 Thomas Hochstein \n"; @@ -78,7 +78,12 @@ if ($Options{'h'}) { my ($Faq) = $Options{'f'} if ($Options{'f'}); # read runtime configuration (configuration variables) -readrc (\$RCFile,\%Config) if -f $RCFile; +$RCFile = $Options{'c'} if ($Options{'c'}); +if (-f $RCFile) { + readrc (\$RCFile,\%Config); +} else { + warn "$0: W: .rc file $RCFile does not exist!\n"; +} # read configuration (configured FAQs) my @Config;