Просмотр исходного кода

Complain about invalid -cfg options

Christoph Berg 21 лет назад
Родитель
Сommit
9af6845bb3
3 измененных файлов с 9 добавлено и 1 удалено
  1. 2 0
      docs/Changelog
  2. 6 0
      modules/Pisg.pm
  3. 1 1
      pisg

+ 2 - 0
docs/Changelog

@@ -6,6 +6,8 @@ pisg (0.66) - ??
    * Add correct ChartsRegexp to documentation.
    * Change -n to -ne in --help output (thanks to Thomas Matthijs for the
      patch).
+   * Complain about invalid -cfg options (closes SF tracker #1183072 by
+     nandmaster).
 
 pisg (0.65) - Fri Apr, 15th 2005
    Christoph:

+ 6 - 0
modules/Pisg.pm

@@ -210,6 +210,8 @@ sub get_default_config_settings
         botnicks => '',            # Needed for DCpp format (non-irc)
 
         statsdump => '',           # Debug option
+        modules_dir => '',         # set in get_cmdline_options
+        cchannels => '',           # set in get_cmdline_options
 
         version => "0.65",
     };
@@ -220,6 +222,10 @@ sub get_default_config_settings
     # Parse the optional overriden configuration variables
     foreach my $key (keys %{$self->{override_cfg}}) {
         if ($self->{override_cfg}->{$key}) {
+            unless (defined($self->{cfg}->{$key})) {
+                print STDERR "Warning: No such configuration option: -cfg $key\n";
+                next;
+            }
             $self->{cfg}->{$key} = $self->{override_cfg}->{$key};
         }
     }

+ 1 - 1
pisg

@@ -147,7 +147,7 @@ END_USAGE
     if (@cfg) {
         foreach (@cfg) {
             if (/(.*)=(.*)/) {
-                $cfg{$1} = $2;
+                $cfg{lc $1} = $2;
             } else {
                 print STDERR "Warning: Couldn't parse -cfg option\n";
             }