anchor.diff:          (uiop:quit))))
   
   (export-always 'start)
  -(defun start (&key urls (init-file (init-file-path)))
  +(defun start (&optional options &rest free-args)
  +  "Parse options (either from command line or from the REPL) and perform the
  +corresponding action.
  +With no action, start the browser.
  +
  +REPL examples:
  +
  +- Display version and return immediately:
  +  (next:start '(:version t))
  +
  +- Start the browser and open the given URLs.
  +  (next:start nil \"https://next.atlas.engineer\" \"https://en.wikipedia.org\")"
  +  ;; Options should be accessible anytime, even when run from the REPL.
  +  (setf *options* options)
  +
  +  (cond
  +    ((getf options :help)
  +     (opts:describe :prefix "Next command line usage:
  +
  +next [options] [urls]"))
  +
  +    ((getf options :version)
  +     (format t "Next version ~a~&" +version+))
  +
  +    ((getf options :script)
  +     (with-open-file (f (getf options :script) :element-type :default)
  +       (maybe-skip-shebang-line f)
  +       (load-lisp f)))
  +
  +    ((or (getf options :load)
  +         (getf options :eval))
  +     (start-load-or-eval))
  +
  +    (t
  +     (start-browser free-args)))
  +
  +  (unless *keep-alive* (uiop:quit)))
  +
  +(defun start-load-or-eval ()
  +  "Evaluate Lisp.
  +The evaluation may happen on its own instance or on an already running instance."
  +  (unless (or (getf *options* :no-init)
  +              (not (init-file-path)))
  +    (load-lisp (init-file-path) :interactive nil :package (find-package :next-user)))
  +  ;; We need a browser instance so that listen-socket-p can know the socket path.
  +  ;; TODO: Use slot default instead?  Ideally, socket could also
  +  ;; be a command line parameter so that multiple instances can be started.
  +  (setf *browser* (make-instance *browser-class*))
  +  (loop for (opt value . _) on *options*
  +        do (match opt
  +             (:load (let ((value (uiop:truename* value)))
  +                      ;; Absolute path is necessary since remote process may have
  +                      ;; a different working directory.
  +                      (if (getf *options* :remote)
  +                          (remote-eval (format nil "~s" `(load-lisp ,value)))
  +                          (load-lisp value))))
  +             (:eval (if (getf *options* :remote)
  +                        (remote-eval value)
  +                        (eval-expr value))))))
  +
  +(defun start-browser (free-args)
     "Load INIT-FILE if non-nil.
   Instantiate `*browser*'.
   Start Next and load URLS if any.
  
positive.code:   (let ((startup-timestamp (local-time:now))
          (startup-error-reporter nil))
      (format t "Next version ~a~&" +version+)
      (setf *session* (derive-session *session*))
      (unless (or (getf *options* :no-init)
                  (not init-file))
        (handler-case
            (load-lisp init-file :interactive t :package (find-package :next-user))
          (error (c)
            (setf startup-error-reporter
                  (lambda ()
  
negative.code:                                    :startup-error-reporter-function startup-error-reporter
                                     :startup-timestamp startup-timestamp))
      (when (single-instance-p *browser*)
        (bind-socket-or-quit free-args))
      (ffi-initialize *browser* free-args startup-timestamp)))
  
  (define-command next-init-time ()
    "Return the duration of Next initialization."
  