+ require 'optparse'
+
+ opt_outfile, opt_errfile, opt_logfile = nil, nil, nil
+ opts = OptionParser.new do |opts|
+ opts.banner = <<"End"
+Usage: #{$0} [OPTIONS]
+End
+ opts.on('-o', '--out OUTFILE', 'Send stdout to OUTFILE.') do |outfile|
+ opt_outfile = outfile
+ end
+ opts.on('-e', '--err ERRFILE', 'Send stderr to ERRFILE.') do |errfile|
+ opt_errfile = errfile
+ end
+ opts.on('-e', '--log LOGFILE', 'Send stdlog to LOGFILE.') do |logfile|
+ opt_logfile = logfile
+ end
+ opts.on_tail('--help', '-h', 'Show this message.') do
+ $stdout.print(opts.to_s)
+ exit(0)
+ end
+ end
+ begin
+ opts.parse!(ARGV)
+ rescue OptionParser::ParseError
+ $stderr.print(opts.to_s)
+ exit(1)
+ end
+
+ server = Server.new(opt_outfile, opt_errfile, opt_logfile)