goprife@gmail.com 0b4c769f10 add uffs (new version, new port)
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2015 bbd45198-f89e-11dd-88c7-29a3b14d5316
2012-04-02 16:12:43 +00:00

25 lines
423 B
Ruby

#usage:
# find . -name "*.c" | xargs /usr/bin/ruby path/to/format_code.rb
#
ARGV.each do |file|
lines = []
count = 0
File.open(file).each_line do |line|
if line =~ /^(.*)\s$/
lines << $1.dup
count += 1
else
lines << line
end
end
if count > 0
f = File.open(file, "w")
lines.each do |s|
f.puts s
end
f.close
puts "Fix file #{file}, modified lines: #{count}"
end
end