[Ecls-list] Command line arguments, :noloadrc, special vars

Matthew Mondor mm_lists at pulsar-zone.net
Sun Jan 23 02:08:21 UTC 2011


Hello again,

In the following test case:

Binding ext:*lisp-init-file-list* or ext:*help-message* don't seem to
take effect, as a) the various default rc files are still tried, b) the
ECL help message is still displayed instead of the custom one.  I'm not
sure what happens here; is it possible that ECL itself invokes the
command processing function and that mine is only executed later?

Also, it seems that :noloadrc has no use with *DEFAULT*, so I'm not
sure how to prevent rc configuration loading without needing at least
one argument...

For standalone executables, it's best for them not to load the ECL
configuration file by default.  I even checked the code and am not sure
why I'm not able to do it.


(let ((ext:*lisp-init-file-list* nil)
      (ext:*help-message* "None"))
  (handler-case (ext:process-command-args
		 :rules '(("*DEFAULT*" 0 nil :noloadrc)))
    (error ()
      (format *error-output* "Error!~%"))))

(defvar *input* *standard-input*)

(defun custom ()
  (let ((*standard-input* *input*))
    (format t "~%Let's read~%")
    (read-line)
    (format t "~%Done~%"))
  (ext:quit))

(restart-case
    (with-input-from-string (s "(custom)") ; custom ini code
      (let ((*standard-input* s))
	(si:top-level)))
  (my-restart ()
    (format t "~%ABORTING!")
    (ext:quit)))
(ext:quit)


$ ktrace ./program
...
$ kdump | grep eclrc | wc -l
13

$ ./program --help
Usage: ecl [-? | --help]
           [-dir dir] [-load file] [-shell file] [-eval expr] [-rc | -norc] [-hp | -nohp]
           [--c-stack size] [--lisp-stack size] [--heap-size size] [--frame-stack size]
           [[-o ofile] [-c [cfile]] [-h [hfile]] [-data [datafile]] [-s] [-q]
            -compile file]
           [[-o ofile] -link file+]
           [--input-encoding external-format] [--output-encoding external-format]
           [--error-encoding external-format] [--encoding external-format]

$ ./program -foo
Unknown command line option -foo.

Usage: ecl [-? | --help]
           [-dir dir] [-load file] [-shell file] [-eval expr] [-rc | -norc] [-hp | -nohp]
           [--c-stack size] [--lisp-stack size] [--heap-size size] [--frame-stack size]
           [[-o ofile] [-c [cfile]] [-h [hfile]] [-data [datafile]] [-s] [-q]
            -compile file]
           [[-o ofile] -link file+]
           [--input-encoding external-format] [--output-encoding external-format]
           [--error-encoding external-format] [--encoding external-format]


In another program, I'm able to have fairly decent behaviour as I
require the -config option, which can use :noloadrc, and instead of
overriding ext:*help-message* I invoke a custom help printing function
in the *DEFAULT* case.  However, some programs require no arguments.

Thanks,
-- 
Matt




More information about the ecl-devel mailing list