changeset 453:c69368f97c10

weather: Rename a variable to be more descriptive.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 10 Oct 2017 01:32:25 +0300
parents ec97c29768e7
children 112f8afa2f04
files weather.tcl
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/weather.tcl	Fri Oct 06 17:30:06 2017 +0300
+++ b/weather.tcl	Tue Oct 10 01:32:25 2017 +0300
@@ -286,25 +286,25 @@
 
   # Check and handle arguments
   set rarglist [::textutil::split::splitx $uargs {\s+}]
-  set rarg [lindex $rarglist 0]
+  set rcmd [lindex $rarglist 0]
 
-  if {$rarg == "?" || $rarg == "help" || $rarg == "apua"} {
-    weather_usage $upublic $unick $uchan "$weather_msg_usage_full"
+  if {$rcmd == "?" || $rcmd == "help" || $rcmd == "apua"} {
+    weather_usage $upublic $unick $uchan $weather_msg_usage_full
     return 0
   }
 
-  if {$rarg == "asemat" || $rarg == "stations"} {
+  if {$rcmd == "asemat" || $rcmd == "stations"} {
     # List stations/locations matching the given pattern
     if {[llength $rarglist] < 2} {
       weather_usage $upublic $unick $uchan $weather_msg_usage_stations
       return 0
     }
 
-    set rarg [join [lrange $rarglist 1 end] " "]
+    set rmatch [join [lrange $rarglist 1 end] " "]
     set result {}
 
     foreach {ukey uvalue} [array get weather_data] {
-      if {![string match "w_*" $ukey] && [string match -nocase "*${rarg}*" $ukey]} {
+      if {![string match "w_*" $ukey] && [string match -nocase "*${rmatch}*" $ukey]} {
         lappend result [weather_get_str $uvalue $weather_msg_list_station]
       }
     }
@@ -312,7 +312,7 @@
     set res [join $result " ; "]
     weather_msg $upublic $unick $uchan $weather_msg_stations [list $res]
     return 0
-  } elseif {$rarg == "lahin" || $rarg == "lähin" || $rarg == "closest" || $rarg == "nearest"} {
+  } elseif {$rcmd == "lahin" || $rcmd == "lähin" || $rcmd == "closest" || $rcmd == "nearest"} {
     # List stations nearest to given coordinates
     set qlist [::textutil::split::splitx [join [lrange $rarglist 1 end] " "] {\s*,\s*}]
     set nlist [lsearch -all -inline -not -exact $qlist ""]
@@ -353,7 +353,7 @@
     set res [join $uresult " ; "]
     weather_msg $upublic $unick $uchan $weather_msg_nearest_stations [list $d_lat $d_lng $res]
     return 0
-  } elseif {$rarg == "vakio" || $rarg == "default" || $rarg == "vakiot" || $rarg == "defaults"} {
+  } elseif {$rcmd == "vakio" || $rcmd == "default" || $rcmd == "vakiot" || $rcmd == "defaults"} {
     # List or set the default weather station name patterns for this user
 
     # Access check
@@ -383,7 +383,7 @@
       }
     }
     return 0
-  } elseif {$rarg == "alias"} {
+  } elseif {$rcmd == "alias"} {
     # Alias a string to another, only certain users have access (+n flag)
     if {![weather_valid_user $uhand] || ![matchattr $uhand n]} {
       weather_msg $upublic $unick $uchan $weather_msg_no_access
@@ -404,7 +404,7 @@
 
     weather_save_aliases
     return 0
-  } elseif {$rarg == "unalias"} {
+  } elseif {$rcmd == "unalias"} {
     # Remove one alias, only certain users have access (+n flag)
     if {![weather_valid_user $uhand] || ![matchattr $uhand n]} {
       weather_msg $upublic $unick $uchan $weather_msg_no_access
@@ -422,7 +422,7 @@
 
     weather_save_aliases
     return 0
-  } elseif {$rarg == "list"} {
+  } elseif {$rcmd == "list"} {
     # List all currently defined aliases
     set ulist {}
     foreach {ukey uvalue} [array get weather_aliases] {