view bin/cek.rb @ 326:b27e43878127

[rc/bash] Better test for Solaris environment.
author Edho Arief <edho@myconan.net>
date Sun, 18 Mar 2012 16:24:28 +0700
parents 72c299437fde
children 324c5842af87
line wrap: on
line source

#!/usr/bin/env ruby
require 'zlib'

block = 1048576
ARGV.each do |filename|
	crc = 0
	file = File.open(filename, 'rb')
	currentbyte = 0
	while (line = file.read(block)) do
		crc = Zlib.crc32(line,crc)
	end
	file.close
	printf("%s %08X\n", filename, crc.to_i)
end