Skip to content
Snippets Groups Projects
Commit 3d18025d authored by Raymond Toy's avatar Raymond Toy
Browse files

Merge branch 'rtoy-29-process-command-line' into 'master'

Fix #29: Update processing of command line

Several related changes here.

- If `:process-command-line` is NIL, `*command-line-strings*` and
  `*command-line-application-arguments*` weren't getting updated.  They
  should get updated so that the resulting core can get updated
  command line options instead of using the values dumped with the
  core.  The command line switch demons are still not run, as before.
- Add a `:quiet` option as if `-quiet` were given.

See merge request !13
parents 1b8f72ed d9090138
No related branches found
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@
;;;; Processing the command strings.
(defun process-command-strings ()
(defun process-command-strings (init-command-switches-p)
(setq *command-line-words* nil)
(setq *command-line-switches* nil)
(let ((cmd-strings lisp::lisp-command-line-list)
......@@ -103,7 +103,7 @@
(return-from process-command-strings nil))
;; Set command line switches.
;;
;;
(loop
(unless str
(return (setf *command-line-switches*
......@@ -119,14 +119,16 @@
(let (word-list)
(loop
(unless str
(push (make-cmd-switch switch value (nreverse word-list))
*command-line-switches*)
(when init-command-switches-p
(push (make-cmd-switch switch value (nreverse word-list))
*command-line-switches*))
(return nil))
(unless (zerop (length (the simple-string str)))
(when (char= #\- (schar str 0))
(push (make-cmd-switch switch value (nreverse word-list))
*command-line-switches*)
(when init-command-switches-p
(push (make-cmd-switch switch value (nreverse word-list))
*command-line-switches*))
(when (and (= (length str) 2)
(char= #\- (schar str 1)))
;; Gather up everything after --, and exit.
......@@ -134,7 +136,7 @@
(setf str nil))
(return nil))
(push str word-list))
(setq str (pop cmd-strings))))))))
(setq str (pop cmd-strings)))))))))
(defun get-command-line-switch (sname)
"Accepts the name of a switch as a string and returns the value of
......
......@@ -153,7 +153,8 @@
(process-command-line t)
#+:executable
(executable nil)
(batch-mode nil))
(batch-mode nil)
(quiet nil))
"Saves a CMU Common Lisp core image in the file of the specified name. The
following keywords are defined:
......@@ -191,8 +192,10 @@
:process-command-line
If true (the default), process command-line switches via the normal
mechanisms, otherwise ignore all switches (except those processed by the
C startup code).
mechanisms, otherwise ignore all switches (except those processed by
the C startup code). In either case, the command line switches are
saved in *COMMAND-LINE-STRINGS* and
*COMMAND-LINE-APPLICATION-ARGUMENTS*.
:executable
If nil (the default), save-lisp will save using the traditional
......@@ -203,7 +206,14 @@
:batch-mode
If nil (the default), then the presence of the -batch command-line
switch will invoke batch-mode processing. If true, the produced core
will always be in batch-mode, regardless of any command-line switches."
will always be in batch-mode, regardless of any command-line switches.
:quiet
If non-NIL, loading, compiling, and GC messages are suppressed.
This is equivalent to setting *load-verbose*, *compile-verbose*,
*compile-print*, *compile-progress*, *require-verbose*, and
*gc-verbose* all to NIL. If NIL (the default), the default
values of these variables are used."
(unless (probe-file (directory-namestring core-file-name))
(error 'simple-file-error
......@@ -240,8 +250,7 @@
(environment-init)
(dolist (f *after-save-initializations*) (funcall f))
(intl::setlocale)
(when process-command-line
(ext::process-command-strings))
(ext::process-command-strings process-command-line)
(setf *editor-lisp-p* nil)
(macrolet ((find-switch (name)
`(find ,name *command-line-switches*
......@@ -249,7 +258,8 @@
:test #'(lambda (x y)
(declare (simple-string x y))
(string-equal x y)))))
(when (and process-command-line (find-switch "quiet"))
(when (or quiet
(and process-command-line (find-switch "quiet")))
(setq *load-verbose* nil
*compile-verbose* nil
*compile-print* nil
......@@ -285,8 +295,9 @@
(ext::invoke-switch-demons *command-line-switches*
*command-switch-demons*))
(when (and print-herald
(not (and process-command-line
(find-switch "quiet"))))
(not (or quiet
(and process-command-line
(find-switch "quiet")))))
;; Don't print the herald if -quiet is given.
(print-herald)))))
(funcall init-function))
......
......@@ -6713,8 +6713,10 @@ msgid ""
"\n"
" :process-command-line\n"
" If true (the default), process command-line switches via the normal\n"
" mechanisms, otherwise ignore all switches (except those processed by the\n"
" C startup code).\n"
" mechanisms, otherwise ignore all switches (except those processed by\n"
" the C startup code). In either case, the command line switches are\n"
" saved in *COMMAND-LINE-STRINGS* and\n"
" *COMMAND-LINE-APPLICATION-ARGUMENTS*.\n"
"\n"
" :executable\n"
" If nil (the default), save-lisp will save using the traditional\n"
......@@ -6725,7 +6727,14 @@ msgid ""
" :batch-mode\n"
" If nil (the default), then the presence of the -batch command-line\n"
" switch will invoke batch-mode processing. If true, the produced core\n"
" will always be in batch-mode, regardless of any command-line switches."
" will always be in batch-mode, regardless of any command-line switches.\n"
"\n"
" :quiet\n"
" If non-NIL, loading, compiling, and GC messages are suppressed.\n"
" This is equivalent to setting *load-verbose*, *compile-verbose*,\n"
" *compile-print*, *compile-progress*, *require-verbose*, and\n"
" *gc-verbose* all to NIL. If NIL (the default), the default\n"
" values of these variables are used."
msgstr ""
 
#: src/code/save.lisp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment