fix tempfile issue

remove dead code
This commit is contained in:
Ward Wouts 2002-05-04 18:12:54 +00:00
parent 773658d7ab
commit 1eb567322a

View file

@ -49,33 +49,13 @@ def save_file(dir, name, data)
end end
end end
#def tmp_file(dir)
# name = "riptmp"
# print "tmpname: #{name}\n" if Debuglevel > 1
# nname = name.gsub(/\//, "-")
# print "nname: #{nname}\n" if Debuglevel > 1
# newname = nname
# count = 1
#
# while FileTest.exists?("#{dir}/#{newname}")
# newname = "#{nname}-#{count}"
# count += 1
# end
# print "name: #{newname}\n" if Debuglevel > 1
# fullname ="#{dir}/#{newname}"
# if file = File.new(fullname, "w+", "0644")
# return file, fullname
# else
# print "couldn't open tempfile for writeing\n"
# end
#end
def parse_options(options) def parse_options(options)
begin begin
opts = GetoptLong.new( opts = GetoptLong.new(
[ "-I", "--include", GetoptLong::REQUIRED_ARGUMENT ], [ "-I", "--include", GetoptLong::REQUIRED_ARGUMENT ],
[ "-c", "--configfile", GetoptLong::REQUIRED_ARGUMENT ], [ "-c", "--configfile", GetoptLong::REQUIRED_ARGUMENT ],
[ "-L", "--longname", GetoptLong::NO_ARGUMENT ], [ "-L", "--longname", GetoptLong::NO_ARGUMENT ],
[ "-M", "--multipart", GetoptLong::NO_ARGUMENT ],
[ "-S", "--singlepart", GetoptLong::NO_ARGUMENT ], [ "-S", "--singlepart", GetoptLong::NO_ARGUMENT ],
[ "-T", "--test", GetoptLong::NO_ARGUMENT ], [ "-T", "--test", GetoptLong::NO_ARGUMENT ],
[ "-X", "--exclude", GetoptLong::REQUIRED_ARGUMENT ], [ "-X", "--exclude", GetoptLong::REQUIRED_ARGUMENT ],
@ -246,7 +226,7 @@ for group in config.keys.sort
elsif articles.group_multipart(i) elsif articles.group_multipart(i)
print " Multipart!\n" print " Multipart!\n"
if config[group]["TEMPDIR"] == nil or config[group]["TEMPDIR"] == "" if config[group]["TEMPDIR"] == nil or config[group]["TEMPDIR"] == ""
body = get_group_body(i) body = articles.get_group_body(i)
if articles.is_uuencoded(body) if articles.is_uuencoded(body)
mode, filename, body = articles.uudecode(body) mode, filename, body = articles.uudecode(body)
else else
@ -255,10 +235,10 @@ for group in config.keys.sort
else else
body = articles.get_group_body_first(i) body = articles.get_group_body_first(i)
if articles.is_uuencoded(body) if articles.is_uuencoded(body)
file = Tempfile.new("#{config[group]["TEMPDIR"]}/riptmp") file = Tempfile.new("riptmp", config[group]["TEMPDIR"])
body.collect{|x| file.print "#{x}\n"} body.collect{|x| file.print "#{x}\n"}
articles.get_group_body_rest(i, file) articles.get_group_body_rest(i, file)
fileout = Tempfile.new("#{config[group]["TEMPDIR"]}/riptmp") fileout = Tempfile.new("riptmp", config[group]["TEMPDIR"])
mode, filename, body = articles.uudecode(file, fileout) mode, filename, body = articles.uudecode(file, fileout)
body = fileout.path body = fileout.path
file.close file.close