 (def- protocol-handlers
   {:binary binary-handler :text text-handler})
 
-(defn run [db-path ephemeral port interface threads protocol]
-  (let [inet          (InetAddress/getByName interface)
+(defn run [db-path ephemeral port addr threads protocol]
+  (let [inet          (InetAddress/getByName addr)
         server-socket (ServerSocket. port 10000 inet)
         pool          (thread-pool/init threads)
         handler       (protocol-handlers protocol)

        (thread-pool/submit pool #(handler dba socket)))
      (recur))))

(cli/with-command-line *command-line-args*
  "FleetDB Server"
  [[f  "Full path to database log."]
   [e? "Ephemeral: do not log database changes to disk." false]
   [p  "TCP port number to listen on." "3400"]
   [a  "Local address to listen on." "127.0.0.1"]
   [t  "Maximum number of worker threads." "100"]
   [i  "Client/server protocol: one of binary or text." "binary"]]
  (run f e? (Integer/decode p) a (Integer/decode t) (keyword i)))

  (:use     (fleetdb util))
  (:require (fleetdb [embedded :as embedded] [io :as io]
                     [thread-pool :as thread-pool])
            (clj-stacktrace [repl :as stacktrace]))
  (:import  (java.net ServerSocket Socket InetAddress)
            (java.io PushbackReader BufferedReader InputStreamReader
                     PrintWriter    BufferedWriter OutputStreamWriter
                     DataInputStream  BufferedInputStream
                     DataOutputStream BufferedOutputStream)
            (joptsimple OptionParser OptionSet OptionException)))

(defn- embedded-query [dba q]
  (let [[q-type q-opts] q]
