minor cleaning

This commit is contained in:
Ward Wouts 2003-04-20 16:58:07 +00:00
parent 12dac93ea1
commit 3670d86420

View file

@ -1,6 +1,6 @@
#################################
#
# $Dwarf: uuencode.rb,v 1.1 2003/04/18 22:53:25 ward Exp $
# $Dwarf: uuencode.rb,v 1.2 2003/04/20 16:34:11 ward Exp $
# $Source$
#
# article.rb
@ -38,7 +38,7 @@ def _uudecode_file(file, outfile)
mode = 0600
filename = "unknown"
c = 0
lines = file.pos
lines = file.pos # horrible assumption FH is at end of file
percent = 0
mark = lines/100
file.pos = 0
@ -66,8 +66,6 @@ def _uudecode_file(file, outfile)
end
print "c: #{c} mark: #{mark} lines: #{lines}\n" if Debuglevel > 1
print " UUdecoding...\n"
while (! file.eof)
if Debuglevel > 1
c = file.pos
@ -83,8 +81,7 @@ def _uudecode_file(file, outfile)
return mode, filename if line =~ /^end/
next if line =~ /[a-z]/
next if line == nil
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i ==
(line.length/4).to_i
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i == (line.length/4).to_i
outfile.print line.unpack("u")
end
@ -128,8 +125,6 @@ def _uudecode_array(data)
return false
end
print "UUdecoding...\n"
while (i < data.length)
if Debuglevel > 1
if c > mark
@ -145,8 +140,7 @@ def _uudecode_array(data)
return mode, filename, decode if line =~ /^end/
next if line =~ /[a-z]/
next if line == nil
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i ==
(line.length/4).to_i
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i == (line.length/4).to_i
decode.concat(line.unpack("u"))
end
@ -164,8 +158,7 @@ end
def get_filename(data)
if data.to_s =~ /^begin(\s+(\d+))?(\s+(.*?\S))?\s*$/m
filename = $4
return filename
return $4
end
return false
end