+(defun process-init-file (truename)
+ (when truename
+ (restart-case
+ (with-open-file (s truename :if-does-not-exist nil)
+ (flet ((next ()
+ (let ((form (read s nil s)))
+ (if (eq s form)
+ (return-from process-init-file nil)
+ (eval form)))))
+ (loop
+ (restart-case
+ (handler-bind ((error (lambda (e)
+ (error
+ "Error during processing of ~
+ initialization file ~A:~%~% ~A"
+ truename e))))
+ (next))
+ (continue ()
+ :report "Ignore and continue processing.")))))
+ (abort ()
+ :report "Skip rest of initialization file."))))
+
+(defun process-eval-options (eval-strings)
+ (/show0 "handling --eval options")
+ (flet ((process-1 (string)
+ (multiple-value-bind (expr pos) (read-from-string string)
+ (unless (eq string (read-from-string string nil string :start pos))
+ (error "More the one expression in ~S" string))
+ (eval expr)
+ (flush-standard-output-streams))))
+ (restart-case
+ (dolist (expr-as-string eval-strings)
+ (/show0 "handling one --eval option")
+ (restart-case
+ (handler-bind ((error (lambda (e)
+ (error "Error during processing of --eval ~
+ option ~S:~%~% ~A"
+ expr-as-string e))))
+ (process-1 expr-as-string))
+ (continue ()
+ :report "Ignore and continue with next --eval option.")))
+ (abort ()
+ :report "Skip rest of --eval options."))))
+