#!/usr/local/bin/ruby # coding: euc-jp require 'kconv' team = Hash.new IO.foreach("vote.tbl") do |x| x = x.toeuc sname, gname = x.scan(/([-0-9a-z]+)\s+(.*)/i)[0] next unless sname && gname team[sname] = gname end point = {} for t in team.keys point[t] = 0 end Dir.foreach(".") {|dir| next unless test(?d, dir) next if /^\./ =~ dir # dir is the same as users login name Dir.foreach(dir){|pt| next if /^\./ =~ pt file = "#{dir}/#{pt}" next unless test(?f, file) sn = open(file, "r").gets.chomp! if point.has_key?(sn) then point[sn] += pt.to_i end } } puts '
" printf("%s (%3d) | \n", team[t], t, point[t]) pt = point[t] print "\n "
printf '![]() |