Author: sparky                       Date: Mon Oct 31 22:51:48 2005 GMT
Module: vfmg                          Tag: DEVEL
---- Log message:
- adden .vfmgrc support, few options fixed
- still not rewritten to use new options

---- Files affected:
vfmg:
   vfmg (1.73.2.15 -> 1.73.2.16) 

---- Diffs:

================================================================
Index: vfmg/vfmg
diff -u vfmg/vfmg:1.73.2.15 vfmg/vfmg:1.73.2.16
--- vfmg/vfmg:1.73.2.15 Mon Oct 31 23:20:50 2005
+++ vfmg/vfmg   Mon Oct 31 23:51:43 2005
@@ -47,15 +47,15 @@
        'icons-scale|S!'=>      \$opt{icons_scale},
        'icons-dir|d=s' =>      \$opt{icons_dir},
 
-       'utf8|u'                =>      \$opt{utf},
+       'utf8|u!'               =>      \$opt{utf},
        'encoding|E=s'  =>      \$opt{encoding},
        
-       'clear|c'               =>      \$opt{clear},
-       'promote|p'             =>      \$opt{promote},
-       'strip|s'               =>      \$opt{strip},
-       'nomenu|m'              =>      \$opt{nomenu},
+       'clear|c!'              =>      \$opt{clear},
+       'promote|p!'    =>      \$opt{promote},
+       'strip|s!'              =>      \$opt{strip},
+       'nomenu|m!'             =>      \$opt{nomenu},
        'xterm|r=s'             =>      \$opt{xterm},
-       'convert|C'             =>      \$opt{convert},
+       'convert|C=s'   =>      \$opt{convert},
        );
 
 my @wms = qw(aewm afterstep blackbox enlightenment fbpanel fluxbox fvwm fvwm2
@@ -104,12 +104,6 @@
        exit;
 }
 
-foreach my $opt (keys %opt) {
-       $opt{$opt} = $defopt{$opt} unless defined $opt{$opt};
-       print "$opt => $opt{$opt}\n";
-}
-exit;
-
 unless (exists $ARGV[0]) {
        local $" = ", ";
        die "Missing argument [EMAIL PROTECTED]";
@@ -118,7 +112,36 @@
 die "Unrecognized argument: $o_output\n"
        unless grep { $o_output eq $_ } @wms;
 
-$opt{full}=1 if $opt{icons} and $o_output=~/^(enlightenment|metisse)$/;
+# vfmgrc {{{
+my @rcFiles = (qw(/etc/vfmgrc), "$ENV{'HOME'}/.vfmgrc");
+push @rcFiles, "$ENV{'HOME_ETC'}/.vfmgrc" if exists $ENV{'HOME_ETC'};
[EMAIL PROTECTED] = grep -r, @rcFiles;
+
+my @rcBody;
+foreach my $rc (@rcFiles) {
+       open F_IN, $rc or next;
+       my $read = 1;
+       while (<F_IN>) {
+               next if ( /^\s*#/ );
+               $read = 0 if /^\[/;
+               if ( /^\[$o_output\]/ ) {
+                       $read = 1;
+                       next;
+               }
+               push @rcBody, $_ if $read;
+       }
+       close F_IN;
+}
+
+my %rcopt = map { /^\s*(.*?)\s*=\s*(.*)\s*$/ } @rcBody;
+# }}}
+
+foreach my $opt (keys %opt) {
+       $opt{$opt} = $rcopt{$opt} unless defined $opt{$opt};
+       $opt{$opt} = $defopt{$opt} unless defined $opt{$opt};
+       print "$opt => $opt{$opt}\n";
+}
+exit;
 # header }}}
 
 # search dirs {{{
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/vfmg/vfmg?r1=1.73.2.15&r2=1.73.2.16&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to