annotate fetch_food.tcl @ 424:825cac46b1cb

Cosmetic / stray trailing whitespace cleanup.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 08 Jan 2017 03:55:55 +0200
parents 599b90e41c03
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 #!/usr/bin/tclsh
1
bdb2b1fd6601 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
2 #
bdb2b1fd6601 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
3 # NOTICE! Change above path to correct tclsh binary path!
bdb2b1fd6601 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
4 #
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 ##########################################################################
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 #
114
593874678e45 Clarify authorship by doing sed "s/ccr\/TNSP/Matti 'ccr' Hamalainen/g".
Matti Hamalainen <ccr@tnsp.org>
parents: 69
diff changeset
7 # RuokaLista fetcher v1.0 by Matti 'ccr' Hamalainen <ccr@tnsp.org>
69
df3230f8aa46 Translate some comments to english and cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
8 # (C) Copyright 2010-2011 Tecnic Software productions (TNSP)
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 #
1
bdb2b1fd6601 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
10 # This script is freely distributable under GNU GPL (version 2) license.
bdb2b1fd6601 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
11 #
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 ##########################################################################
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
69
df3230f8aa46 Translate some comments to english and cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
14 # Path and filename of the data file, MUST BE SAME as in "ruoka.tcl"
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 set datafile "/home/niinuska/bot/data.ruoka"
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16
69
df3230f8aa46 Translate some comments to english and cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
17 # Use a HTTP proxy? (1 = yes, 0 = no)
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 set http_proxy 0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19
69
df3230f8aa46 Translate some comments to english and cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
20 # HTTP proxy host address and port (only needed if use_proxy = 1)
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 set http_proxy_host "cache.inet.fi"
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 set http_proxy_port 800
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
69
df3230f8aa46 Translate some comments to english and cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
25 ##########################################################################
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 set html_ent [split "\n| |\r| |<br />| |&nbsp;| |&#160;| |&raquo;|>>|&quot;|\"|&auml;|ä|&ouml;|ö|&Auml;|Ä|&Ouml;|Ö|&amp;|&|&lt;|<|&gt;|>|ä|ä|ö|ö|Ä|Ä" "|"]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 package require http
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 ::http::config -urlencoding iso8859-1 -useragent "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 9.5"
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 if {$http_proxy != 0} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 ::http::config -proxyhost $http_proxy_host -proxyport $http_proxy_port
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 proc convert_ent {udata} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 global html_ent
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 return [string map $html_ent $udata]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 proc add_entry {uname uday udate udesc} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 global entries
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 set utest "$uname:$udate"
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 if {[catch {set utmp $entries($utest)}]} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 set entries($utest) [list $uname $uday $udate $udesc]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 proc add_amica {datauri dataname} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 if {[catch {set utoken [::http::geturl $datauri -binary true -timeout 5000]} uerrmsg]} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 puts "Error getting $datauri: $uerrmsg"
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 return 1
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 set upage [::http::data $utoken]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 ::http::cleanup $utoken
424
825cac46b1cb Cosmetic / stray trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
58
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 set nmatches 1
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 while {$nmatches > 0} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 set umatches [regexp -nocase -inline -- "<strong>(Maanantai|Tiistai|Keskiviikko|Torstai|Perjantai|Lauantai|Sunnuntai)</strong></td>.?.?<td colspan=\"2\"><strong>(\[^<\]+)</strong></td>(.*)\$" $upage]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 set nmatches [llength $umatches]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 if {$nmatches > 3} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 set umat [regexp -nocase -inline -- "^(.+?)(<td colspan=\"3\">|</tbody>)" [lindex $umatches 3]]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 set umat [regexp -all -nocase -inline -- "<td colspan=\"\[78\]\">(.\*\?)</td>" [lindex $umat 1]]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 set tmp ""
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 foreach {ukey udata} $umat {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 set item [string trim [convert_ent $udata]]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 if {[string length $item] > 0} {
63
7b03971c6d28 Remove tabs and reindent.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
70 lappend tmp $item
7b03971c6d28 Remove tabs and reindent.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
71 }
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 add_entry $dataname [lindex $umatches 1] [lindex $umatches 2] [join $tmp "; "]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 set upage [lindex $umatches 3]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 }
424
825cac46b1cb Cosmetic / stray trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
77
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 return 0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 proc add_uniresta {datauri dataname} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 if {[catch {set utoken [::http::geturl $datauri -binary true -timeout 5000]} uerrmsg]} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 puts "Error getting $datauri: $uerrmsg"
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 return 1
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 set upage [::http::data $utoken]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 ::http::cleanup $utoken
6
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
89
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 set nmatches 1
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 while {$nmatches > 0} {
6
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
92 # set umatches [regexp -nocase -inline -- "<span class='otsikko'><b>(Maanantai|Tiistai|Keskiviikko|Torstai|Perjantai|Lauantai|Sunnuntai) \[0-9\]+\.\[0-9\]+</b></span><P>(\[^<\]+)</span>(.*)\$" $upage]
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
93 set umatches [regexp -nocase -inline -- "<span class='otsikko'><b>(Maanantai|Tiistai|Keskiviikko|Torstai|Perjantai|Lauantai|Sunnuntai) +\[0-9\]+\.\[0-9\]+</b></span>(.*?)</span>(.*)$" $upage]
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 set nmatches [llength $umatches]
6
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
95 puts "[lindex $umatches 1]"
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 if {$nmatches > 3} {
6
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
97 # set umat [regexp -nocase -inline -- "^(.+?)<br>" [lindex $umatches 3]]
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
98 set umat [regexp -all -nocase -inline -- "(.\*\?)<br>" [lindex $umatches 2]]
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 set tmp ""
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 foreach {ukey udata} $umat {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 set item [string trim [convert_ent $udata]]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 if {[string length $item] > 0} {
63
7b03971c6d28 Remove tabs and reindent.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
103 lappend tmp $item
7b03971c6d28 Remove tabs and reindent.
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
104 }
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 add_entry $dataname [lindex $umatches 1] [lindex $umatches 2] [join $tmp "; "]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 set upage [lindex $umatches 3]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 }
424
825cac46b1cb Cosmetic / stray trailing whitespace cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 258
diff changeset
110
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 return 0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114
69
df3230f8aa46 Translate some comments to english and cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
115 ##########################################################################
6
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
116 set kello [clock seconds]
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
117 set viikko [expr [clock format $kello -format "%W"] + 1]
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
118 set vuosi [clock format $kello -format "%Y"]
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
119
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 # Amica/OAMK tekniikan yksikkö
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 add_amica "http://www.amica.fi/kotkanpoika" "OAMK"
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 # Oulun yliopiston Unirestat
6
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
124 set str "http://www.uniresta.fi/2010/ruokalista_tulostettava.php?viikko=$viikko&vuosi=$vuosi&ravintola"
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
125
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
126 add_uniresta "$str=2" "Aularavintola"
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
127 add_uniresta "$str=3" "Discus"
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
128 add_uniresta "$str=4" "Julinia"
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
129 add_uniresta "$str=5" "Kastari"
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
130 add_uniresta "$str=6" "Snellmania"
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
131 add_uniresta "$str=7" "Pruxis"
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
132 add_uniresta "$str=10" "Vanilla"
026257a62da4 ruoka: Some fixes, does not work with the new Amica lists tho.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
133 add_uniresta "$str=11" "Minttu"
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135
69
df3230f8aa46 Translate some comments to english and cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
136 ##########################################################################
0
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 ### Open result datafile and save data
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 set tmpfname "$datafile.tmp"
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 if {[catch {set outfile [open $tmpfname w 0600]} uerrmsg]} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 puts "Error opening $tmpfname for writing: $uerrmsg"
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 return 1
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 foreach {ukey udata} [array get entries] {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 puts $outfile [join $udata "½"]
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 }
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 close $outfile
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 if {[catch {file rename -force -- $tmpfname $datafile} uerrmsg]} {
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 puts "Error renaming $tmpfname to $datafile: $uerrmsg"
1c4e2814cd41 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 }