/* Copyright (c) 1993 by Olin Shivers. ** Adapted for CMUCL by Eric Marsden, 2001-01-17 ** ** Time-stamp: <2001-12-04 emarsden> ** ** Please imagine a long, tedious, legalistic 5-page gnu-style copyright ** notice appearing here to the effect that you may use this code any ** way you like, as long as you don't charge money for it, remove this ** notice, or hold me liable for its results. */ /*************************************************************************** This is the trampoline for CMUCL shell scripts. Your shell script starts something like #!/usr/bin/cmucl-trampoline \ -quiet -batch -noinit #! which this program transforms into an exec() of the CMUCL runtime, followed by the arguments on the second line, followed by '-load' and the name of the script file. If you want to use a specialized image for shell scripts, modify the main to add an appropriate '-core' argument to new_argv. Your image needs to contain a reader macro which treats #!...!# forms as comments; something like (set-dispatch-macro-character #\# #\! #'(lambda (stream char int) (declare (ignore char int)) (loop :for c = (read-char stream t nil t) :while c :until (and (char= c #\#) (char= (peek-char nil stream) #\!))) (read-char stream t nil) (values))) You can access the script filename as EXT:*COMMAND-LINE-UTILITY-NAME*, and the commandline arguments as (cdr (member "-eval=(ext:quit)" *command-line-strings* :test #'string=)) Thanks to Robert Pluim for a bigfix. ****************************************************************************/ /* Using the #! interpreter hack in Unix for making scripts has a big ** problem: you only get 1 argument after the interpreter on the #! line. ** This subroutine helps to fix that. ** ** Below is a procedure that will arrange for a command-line switch of the ** form \