Author: sparky
Date: Mon Oct 12 02:51:38 2009
New Revision: 10762

Modified:
   toys/rsget.pl/rsget.pl
Log:
- introduce RSGET_DIR environment variable, use it when ${HOME}/.rsget.pl
  isn't good enough
- allow env variables in config file


Modified: toys/rsget.pl/rsget.pl
==============================================================================
--- toys/rsget.pl/rsget.pl      (original)
+++ toys/rsget.pl/rsget.pl      Mon Oct 12 02:51:38 2009
@@ -16,6 +16,8 @@
 unshift @INC, $install_path;
 
 my $cdir = "$ENV{HOME}/.rsget.pl";
+$cdir = $ENV{RSGET_DIR} if $ENV{RSGET_DIR};
+$ENV{RSGET_DIR} = $cdir;
 read_config( "$cdir/config" );
 
 my @save_ARGV = @ARGV;
@@ -70,8 +72,9 @@
                $line++;
                next if /^\s*(?:#.*)?$/;
                chomp;
-               if ( s/^\s*([a-z_]+)\s*=\s*(.*?)\s*$// ) {
-                       set( $1, $2, "config file, line $line" );
+               if ( my ( $key, $value ) = /^\s*([a-z_]+)\s*=\s*(.*?)\s*$/ ) {
+                       $value =~ s/\${([a-zA-Z0-9_]+)}/$ENV{$1} || ""/eg;
+                       set( $key, $value, "config file, line $line" );
                        next;
                }
                warn "Incorrect config line: $_\n";
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to