get rid of old SVN structure
This commit is contained in:
parent
64eaf7c89f
commit
08e83501be
324 changed files with 0 additions and 70245 deletions
55
encode/tests/ydec.rb
Executable file
55
encode/tests/ydec.rb
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/env ruby
|
||||
# encoding: ASCII-8BIT
|
||||
|
||||
require "../yenc.rb"
|
||||
require 'getoptlong'
|
||||
require 'fileutils'
|
||||
|
||||
def usage
|
||||
puts <<EOT
|
||||
Usage: #{$0.sub(/.*\//, "")} [options] <file>
|
||||
|
||||
-h, --help show this message
|
||||
-o <outfile> output file
|
||||
EOT
|
||||
exit
|
||||
end
|
||||
|
||||
def cmdline
|
||||
options = Hash.new
|
||||
begin
|
||||
opts = GetoptLong.new(
|
||||
[ "-h", "--help", GetoptLong::NO_ARGUMENT ],
|
||||
[ "-o", GetoptLong::REQUIRED_ARGUMENT ]
|
||||
)
|
||||
opts.quiet=true
|
||||
|
||||
opts.each do |opt, arg|
|
||||
options[opt] = arg
|
||||
end
|
||||
|
||||
rescue
|
||||
print "#{$!}\n"
|
||||
usage
|
||||
end
|
||||
if options["-h"]
|
||||
usage
|
||||
end
|
||||
return options
|
||||
end
|
||||
|
||||
options = cmdline
|
||||
file = ARGV[0]
|
||||
|
||||
filehandle = File.open(file, "r")
|
||||
tmpfile = Tempfile.new("ynctmp")
|
||||
tmpfile.sync=true
|
||||
mode, filename, body = YEnc.ydecode(filehandle, tmpfile)
|
||||
puts "Mode: #{mode}"
|
||||
puts "Filename: #{filename}"
|
||||
if !options["-o"].nil?
|
||||
FileUtils.mv(tmpfile, options["-o"])
|
||||
end
|
||||
filehandle.close
|
||||
tmpfile.close
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue