All Manuals > LispWorks® User Guide and Reference Manual > 27 LispWorks' Operating Environment

27.4 The Command Line

The command line used to run LispWorks can be found using the variable *line-arguments-list*. The value is a list of strings containing the executable name followed by any other command line arguments, in the order they were passed.

The strings of the command line arguments are decoded using the same external format which is used for encoding file names, as described in 27.14.1 Encoding of file names and strings in OS interface functions.

For example, if your application needs to behave differently when passed an argument -foo, use the following test:

(member "-foo" sys:*line-arguments-list* :test 'string=)

27.4.1 Command Line Arguments

The following command line options are supported by the system.

-build build-script

Typically this is used for the purpose of building another image.

build-script can name a file to be loaded on startup. This file will be the build script which loads your code and calls save-image or deliver. LispWorks quits after loading the file. If an error is signaled while loading the file, a backtrace is displayed and LispWorks quits.

build-script can also be -, a single minus sign. Passing -build - causes LispWorks to read and execute a build script from stdin. This is useful if you want to embed a build script within a shell script that runs LispWorks, for example:

lispworks-8-0-0-x86-linux -build - <<END
(write-line "This is the build script.")
END

Note that this technique using <<END does not work on Microsoft Windows.

An image run with -build runs itself, and not the default saved session if you created one. See 13.4 Saved sessions for information on saved sessions.

-build calls load-all-patches automatically. There is no harm if your build script also calls load-all-patches.

-environment

Start the LispWorks IDE development environment automatically, even in an image saved with:

(save-image ... :environment nil)
-eval form

Evaluates the Lisp form form before loading initialization files.

If form requires multiprocessing, then change it to push a process specification onto *initial-processes*. This will delay evaluation until multiprocessing has started, either by the -multiprocessing command line options or because LispWorks was saved to start multiprocessing.

-env
A synonym for -environment.
-display display

Sets the X display to use when starting a LispWorks GUI on X Windows.

-IIOPhost host

Controls the host name in placed in IORs. See Developing Component Software with CORBA® for details.

-IIOPnumeric

IORs contain a host name which is the numeric IP address obtained by reverse lookup of the machine name. See Developing Component Software with CORBA® for details.

-init init-file

init-file names a file to be loaded on startup after siteinit-file. The file is user's own LispWorks initialization file, containing code that by default is loaded when LispWorks is started. It is useful for loading initializations that should not be done for all users.

Initially the default is to load the file "~/.lispworks" where ~ expands to the user's home directory as described in 13.2 Configuration and initialization files.

Your default initialization file can be set in the LispWorks IDE. See "Setting Preferences" in the LispWorks IDE User Guide for details.

If init-file is not found, an error is signaled. To suppress loading of a user initialization file, pass -init -.

-load file
Loads the file file before loading initialization files.
-lw-no-redirection

Makes the supplied image run itself, and not the default saved session if you created one. See 13.4 Saved sessions for information on saved sessions.

-multiprocessing

Initializes multiprocessing on startup. See 19 Multiprocessing.

-no-restart-function

Suppresses the execution of a restart function on startup. Restart functions can be supplied when saving an image to automatically invoke application code. This argument suppresses that behavior. See save-image.

-ORBport orbport

orbport specifies a port number for the LispWorks ORB. The special value 0 allows the system to pick a port.

--relocate-image BaseAddress

Causes the image to relocate at BaseAddress on supported platforms, as described in 27.6 Startup relocation. This can be useful on a system where libraries are mapped in address space that LispWorks would otherwise use as it grows. If the image is saved, then on restart without --relocate-image, it will locate itself automatically at BaseAddress.

Compatibility note: In LispWorks 5.0 and earlier versions, to be effective, --relocate-image must be the first argument on the LispWorks command line. This restriction does not apply in LispWorks 8.0.

--reserve-size ReserveSize

Specifies the reserve size on supported platforms, as described in 27.6 Startup relocation.

-siteinit siteinit-file

siteinit-file names a file to be loaded on startup. The file is the LispWorks site initialization file, containing code that by default is loaded when LispWorks is started by any user in that installation. The default is to load the file that is the result of evaluating:

(sys:lispworks-file "config/siteinit.lisp")

If siteinit-file is not found, an error is signaled. To suppress loading of a site initialization file, pass -siteinit -.

27.4.2 Accessing environment variables

Use environment-variable get and set the value of an environment variable in the environment table of the OS process that called LispWorks.

To remove FOO from the environment table do:

(setf (lw:environment-variable "FOO") nil)

On non-Windows platforms, the environment variables are encoded as specfied in 27.14.1 Encoding of file names and strings in OS interface functions.


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:24