diff options
author | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-02-27 07:48:11 +0000 |
---|---|---|
committer | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-02-27 07:48:11 +0000 |
commit | 7425d4f6ef047dd274cbea8115955462d5449330 (patch) | |
tree | 575dcd5c8f6df0908e4198376441d4257dcde75d /sample/tkfrom.rb | |
parent | fd1d8cdc09ed86e4a0812120a17ff0d7b04adcaf (diff) |
This commit was manufactured by cvs2svn to create tag 'r1_1b9'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/r1_1b9@100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/tkfrom.rb')
-rw-r--r-- | sample/tkfrom.rb | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/sample/tkfrom.rb b/sample/tkfrom.rb index b0ef8995ca..ba0e547799 100644 --- a/sample/tkfrom.rb +++ b/sample/tkfrom.rb @@ -94,25 +94,31 @@ root.bind "space", proc{exit} $outcount = 0; for file in ARGV - next if !File.exist?(file) + next if File.exist?(file) + atime = File.atime(file) + mtime = File.mtime(file) f = open(file, "r") - while !f.eof - mail = Mail.new(f) - date = mail.header['Date'] - next if !date - from = mail.header['From'] - subj = mail.header['Subject'] - y = m = d = 0 - y, m, d = parsedate(date) if date - from = "sombody@somewhere" if ! from - subj = "(nil)" if ! subj - from = decode_b(from) - subj = decode_b(subj) - list.insert 'end', format('%-02d/%02d/%02d [%-28.28s] %s',y,m,d,from,subj) - $outcount += 1 + begin + until f.eof + mail = Mail.new(f) + date = mail.header['Date'] + next unless date + from = mail.header['From'] + subj = mail.header['Subject'] + y = m = d = 0 + y, m, d = parsedate(date) if date + from = "sombody@somewhere" unless from + subj = "(nil)" unless subj + from = decode_b(from) + subj = decode_b(subj) + list.insert 'end', format('%-02d/%02d/%02d [%-28.28s] %s',y,m,d,from,subj) + $outcount += 1 + end + ensure + f.close + File.utime(atime, mtime, file) + list.see 'end' end - f.close - list.see 'end' end limit = 10000 |