3 ;;; Portable command-line tools in Lisp
5 ;;; (c) 2006 Straylight/Edgeware
8 ;;;----- Licensing notice ---------------------------------------------------
10 ;;; This program is free software; you can redistribute it and/or modify
11 ;;; it under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 2 of the License, or
13 ;;; (at your option) any later version.
15 ;;; This program is distributed in the hope that it will be useful,
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with this program; if not, write to the Free Software Foundation,
22 ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 (:export #:*lisp-interpreter* #:*command-line-strings* #:run)
28 #+cmu (:import-from #:ext #:*command-line-strings*))
29 (in-package #:runlisp)
32 (defvar *lisp-interpreter*)
33 (defvar *command-line-strings* nil)
35 ;;; Ignore shebang lines.
36 (set-dispatch-macro-character #\# #\!
37 (lambda (stream bang arg)
38 (declare (ignore bang arg))
42 ;;; Shut up, you bastard.
43 #+cmu (setf ext:*gc-verbose* nil)
45 (setf *compile-verbose* nil
51 ;;; Find command-line arguments and run the program.
54 #+cmu (let ((args lisp::lisp-command-line-list))
55 (setf *lisp-interpreter* (pop args))
56 (assert (string= (pop args) "-core"))
58 (setf *command-line-strings* args))
59 #+ecl (setf *lisp-interpreter* (ext:argv 0)
60 *command-line-strings* (loop for i from 1 below (ext:argc)
61 collect (ext:argv i)))
62 #+clisp (let ((args (coerce (ext:argv) 'list)))
63 (setf *lisp-interpreter* (car args)
64 *command-line-strings* (nthcdr 7 args)))
65 (let ((*package* (find-package "COMMON-LISP-USER"))
66 (prog (car *command-line-strings*)))
70 (format *error-output* "~&~A: ~A~%" (pathname-name prog) cond)
74 ;;;----- That's all, folks --------------------------------------------------