From: Mark Wooding Date: Wed, 26 Nov 2008 21:23:09 +0000 (+0000) Subject: sys-base: Further cl-launch improvement. X-Git-Url: https://git.distorted.org.uk/~mdw/lisp/commitdiff_plain/460f9a0dd7568719bd102dc5df8d52b4d41423dd?hp=1cbc65e7d3d318b21fa3793676ad203a799e2206 sys-base: Further cl-launch improvement. If CL_LAUNCH_FILE is unset, assume that we've been invoked with the program name as the first argument anyway. We can arrange for this to be the case fairly easily. The problem is that #! /usr/bin/cl-launch -X ... -- doesn't work on Linux because cl-launch is a script. Besides, it hard-codes the path of cl-launch. Putting #! /bin/sh #| exec cl-launch -f "$0" -- "$0" "$@" |# ... lisp here ... seems sufficient for one-off Lisp scripts. --- diff --git a/sys-base.lisp b/sys-base.lisp index bb1cd45..904c165 100644 --- a/sys-base.lisp +++ b/sys-base.lisp @@ -42,11 +42,14 @@ (defun set-command-line-arguments () (setf *raw-command-line* (or (when (member :cl-launched *features*) - (cons (or (funcall (intern "GETENV" (find-package :cl-launch)) - "CL_LAUNCH_FILE") - "") - (symbol-value (intern "*ARGUMENTS*" - (find-package :cl-launch))))) + (let* ((cll-package (find-package :cl-launch)) + (name (funcall (intern "GETENV" cll-package) + "CL_LAUNCH_FILE")) + (args (symbol-value (intern "*ARGUMENTS*" + cll-package)))) + (if name + (cons name args) + args))) #+cmu ext:*command-line-strings* #+sbcl sb-ext:*posix-argv* #+ecl (loop from i below (ext:argc) collect (ext:argv i))