Mercurial > hg > egg-tcls
diff hae_saatiedot.tcl @ 63:7b03971c6d28
Remove tabs and reindent.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 08 Sep 2011 22:26:52 +0300 |
parents | 1c4e2814cd41 |
children | df3230f8aa46 |
line wrap: on
line diff
--- a/hae_saatiedot.tcl Thu Sep 08 22:23:33 2011 +0300 +++ b/hae_saatiedot.tcl Thu Sep 08 22:26:52 2011 +0300 @@ -17,29 +17,29 @@ package require http ::http::config -urlencoding iso8859-1 -useragent "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 9.5" if {$use_proxy != 0} { - ::http::config -proxyhost $http_proxy_host -proxyport $http_proxy_port + ::http::config -proxyhost $http_proxy_host -proxyport $http_proxy_port } ############################################################################## proc fetch_uri {uurl} { - global ngot - if {[catch {set utoken [::http::geturl $uurl -binary true -timeout 5000]} uerrmsg]} { - puts "Error getting #$uurl: $uerrmsg" - return "" - } else { - incr ngot - set udata [::http::data $utoken] - ::http::cleanup $utoken - return $udata - } + global ngot + if {[catch {set utoken [::http::geturl $uurl -binary true -timeout 5000]} uerrmsg]} { + puts "Error getting #$uurl: $uerrmsg" + return "" + } else { + incr ngot + set udata [::http::data $utoken] + ::http::cleanup $utoken + return $udata + } } ############################################################################## set tmpfname "$datafile.tmp" if {[catch {set savefile [open $tmpfname w 0600]} uerrmsg]} { - puts "Error opening $tmpfname: $uerrmsg" - return 1 + puts "Error opening $tmpfname: $uerrmsg" + return 1 } # Haetaan 22 framea osoitteista @@ -48,15 +48,15 @@ # ja talletetaan kaikki samaan tiedostoon set ngot 0 for { set i 1 } { $i < 23 } { incr i } { - puts $savefile [fetch_uri "http://alk.tiehallinto.fi/alk/tiesaa/tiesaa_maak_$i.html"] + puts $savefile [fetch_uri "http://alk.tiehallinto.fi/alk/tiesaa/tiesaa_maak_$i.html"] } #set paske [fetch_uri "http://www.wunderground.com/global/stations/56294.html"] close $savefile if {$ngot > 5} { - if {[catch {file rename -force -- $tmpfname $datafile} uerrmsg]} { - puts "Error renaming $tmpfname to $datafile: $uerrmsg" - } + if {[catch {file rename -force -- $tmpfname $datafile} uerrmsg]} { + puts "Error renaming $tmpfname to $datafile: $uerrmsg" + } }