Permalink
Browse files

Merge branch 'master' of github.com:lokedhs/trivial-shell

  • Loading branch information...
2 parents 4c0e767 + 7a0ad09 commit 3549f756bcf4290b29eb3662a059aff9340eb3b4 @lokedhs committed Sep 4, 2012
Showing with 17 additions and 2 deletions.
  1. +3 −1 dev/cmucl.lisp
  2. +14 −1 dev/sbcl.lisp
View
@@ -24,4 +24,6 @@
ext:*environment-list*)))
(defun %exit (code)
- (ext:quit code))
+ (unless (zerop code)
+ (error "CMUCL does not support exit codes."))
+ (ext:quit))
View
@@ -86,5 +86,18 @@
(defun %get-env-var (name)
(sb-ext:posix-getenv name))
+(defun symbol-if-external (name package)
+ (multiple-value-bind (symbol s) (find-symbol name package)
+ (when (eq s :external)
+ symbol)))
+
(defun %exit (code)
- (sb-ext:exit :code code))
+ (let ((exit-sym (symbol-if-external "EXIT" "SB-EXT")))
+ (if exit-sym
+ (funcall exit-sym :code code)
+ (let ((quit-sym (symbol-if-external "QUIT" "SB-EXT")))
+ (if quit-sym
+ (if (zerop code)
+ (funcall quit-sym :recklessly-p t)
+ (error "This version of SBCL does not support exiting with a code."))
+ (error "SBCL version without EXIT or QUIT."))))))

0 comments on commit 3549f75

Please sign in to comment.