#!/usr/bin/env ruby
# Copyright (C) 2003-2005 Kouichirou Eto, All rights reserved.

base = File.dirname(__FILE__)+"/.." # /usr/local/qwik/bin -> /usr/local/qwik
$LOAD_PATH.unshift(File.expand_path(base+"/lib"))
$LOAD_PATH.unshift(File.expand_path(base+"/compat"))

require "qwik/server"

def main(argv)
  config = Qwik::Config.new
  config.parse_argv(argv)
  memory = Qwik::ServerMemory.new(config)
  server = Qwik::Server.new(config, memory)
  trap(:TERM) { server.shutdown; }
  trap(:INT)  { server.shutdown; }
  server.start
end
main(ARGV)
