[AudioLink-cvs]audiolink/code alfilldb,1.30,1.31
Status: Alpha
Brought to you by:
amitshah
|
From: <ami...@us...> - 2003-12-05 12:24:06
|
Update of /cvsroot/audiolink/audiolink/code
In directory sc8-pr-cvs1:/tmp/cvs-serv4484
Modified Files:
alfilldb
Log Message:
1. config file isn't perl code now; simple "a = b" stuff
2. command-line args override config file options
Index: alfilldb
===================================================================
RCS file: /cvsroot/audiolink/audiolink/code/alfilldb,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** alfilldb 4 Dec 2003 16:11:59 -0000 1.30
--- alfilldb 5 Dec 2003 12:24:03 -0000 1.31
***************
*** 406,415 ****
# execution starts here
- $config_file = "$ENV{HOME}/.audiolink/config";
-
- unless (do $config_file) {
- warn "WARNING: Couldn't parse the config file, $config_file: $@" if $@;
- warn "WARNING: Couldn't read the config file, $config_file: $!";
- }
# check for command-line arguments
--- 406,409 ----
***************
*** 468,471 ****
--- 462,484 ----
} else { # no option specified, default to add and update
$addmode = $updmode = 1;
+ }
+
+ $config_file = "$ENV{HOME}/.audiolink/config";
+
+ if (-e $config_file) {
+ open(CONFFILE, $config_file);
+
+ # go through the config file
+ while (<CONFFILE>) {
+ if (/^\s*user\s*\=+\s*(\w+)/) {
+ chomp($user = $1) unless $user;
+ } elsif ( /^\s*pass(word)?\s*=\s*(\w+)/) {
+ chomp($password = $2) unless $password;
+ } elsif ( /^\s*host\s*=\s*(\w+)/) {
+ chomp($host = $1) unless $host;
+ }
+ }
+ } else {
+ warn "WARNING: config file not found. Use the audiolink script to create one.\n";
}
|