minor cleaning
This commit is contained in:
parent
12dac93ea1
commit
3670d86420
1 changed files with 6 additions and 13 deletions
|
|
@ -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$
|
# $Source$
|
||||||
#
|
#
|
||||||
# article.rb
|
# article.rb
|
||||||
|
|
@ -38,10 +38,10 @@ def _uudecode_file(file, outfile)
|
||||||
mode = 0600
|
mode = 0600
|
||||||
filename = "unknown"
|
filename = "unknown"
|
||||||
c = 0
|
c = 0
|
||||||
lines = file.pos
|
lines = file.pos # horrible assumption FH is at end of file
|
||||||
percent = 0
|
percent = 0
|
||||||
mark = lines/100
|
mark = lines/100
|
||||||
file.pos=0
|
file.pos = 0
|
||||||
|
|
||||||
while (! file.eof)
|
while (! file.eof)
|
||||||
line = file.gets
|
line = file.gets
|
||||||
|
|
@ -66,8 +66,6 @@ def _uudecode_file(file, outfile)
|
||||||
end
|
end
|
||||||
print "c: #{c} mark: #{mark} lines: #{lines}\n" if Debuglevel > 1
|
print "c: #{c} mark: #{mark} lines: #{lines}\n" if Debuglevel > 1
|
||||||
|
|
||||||
print " UUdecoding...\n"
|
|
||||||
|
|
||||||
while (! file.eof)
|
while (! file.eof)
|
||||||
if Debuglevel > 1
|
if Debuglevel > 1
|
||||||
c = file.pos
|
c = file.pos
|
||||||
|
|
@ -83,8 +81,7 @@ def _uudecode_file(file, outfile)
|
||||||
return mode, filename if line =~ /^end/
|
return mode, filename if line =~ /^end/
|
||||||
next if line =~ /[a-z]/
|
next if line =~ /[a-z]/
|
||||||
next if line == nil
|
next if line == nil
|
||||||
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i ==
|
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i == (line.length/4).to_i
|
||||||
(line.length/4).to_i
|
|
||||||
outfile.print line.unpack("u")
|
outfile.print line.unpack("u")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -128,8 +125,6 @@ def _uudecode_array(data)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
print "UUdecoding...\n"
|
|
||||||
|
|
||||||
while (i < data.length)
|
while (i < data.length)
|
||||||
if Debuglevel > 1
|
if Debuglevel > 1
|
||||||
if c > mark
|
if c > mark
|
||||||
|
|
@ -145,8 +140,7 @@ def _uudecode_array(data)
|
||||||
return mode, filename, decode if line =~ /^end/
|
return mode, filename, decode if line =~ /^end/
|
||||||
next if line =~ /[a-z]/
|
next if line =~ /[a-z]/
|
||||||
next if line == nil
|
next if line == nil
|
||||||
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i ==
|
next unless ((((line[0] - 32) & 077) + 2) / 3).to_i == (line.length/4).to_i
|
||||||
(line.length/4).to_i
|
|
||||||
decode.concat(line.unpack("u"))
|
decode.concat(line.unpack("u"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -164,8 +158,7 @@ end
|
||||||
|
|
||||||
def get_filename(data)
|
def get_filename(data)
|
||||||
if data.to_s =~ /^begin(\s+(\d+))?(\s+(.*?\S))?\s*$/m
|
if data.to_s =~ /^begin(\s+(\d+))?(\s+(.*?\S))?\s*$/m
|
||||||
filename = $4
|
return $4
|
||||||
return filename
|
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue