A string containing the home directory of the user.
Returns a nonempty list of immutable strings. The first element is an implementation-specific name for the running top-level program. The remaining elements are the command-line arguments, as passed to the
main
method (except for those flags processed by Kawa itself).The first element will depend on how the Kawa module was invoked. Kawa uses the following rules to determine the command name:
If the property
kawa.command.name
is set, that is used. This variable can be set on thekawa
command line, for example from a script:kawa -Dkawa.command.name="$0" foo "$@"This variable is also set implicitly by the meta-arg option. FIXME.
If we’re reading a source file that starts with the Unix command-file prefix ‘
#!/
’ then we use the name of the source file. The assumption is that such a file is an executable script.If the Java property
kawa.command.line
is set, then we use that (after stripping off text that duplicates the remaining arguments). Thekawa
program sets this property to the command line used to invoke it (specifically the contents of the entireargv
array), before invoking thejava
program.If the Java property
sun.java.command
is set, then we use that (after stripping off text that duplicates the remaining arguments), and then prepending the string"java "
. The OpenJDKjava
program sets this property.If all else fails, the command name is
"kawa"
.
Variable: command-line-arguments
Any command-line arguments (following flags processed by Kawa itself) are assigned to the global variable ‘
command-line-arguments
’, which is a vector of strings.
Procedure: process-command-line-assignments
Process any initial command-line options that set variables. These have the form
. Any such command-line options (at the start of the command-line) are processed and removed from the command-line.
name
=value
$ java kawa.repl -- abc=123 def #|kawa:1|# (write (command-line)) ("java kawa.repl --" "abc=123" "def") #|kawa:2|# (process-command-line-assignments) #|kawa:3|# (write (command-line)) ("java kawa.repl -- abc=123" "def") #|kawa:4|# abc 123This function is mostly useful for Kawa applications compiled with the
--main
option. (It is used to set XQueryexternal
variables.)
Procedure: get-environment-variable
name
Many operating systems provide each running process with an environment conisting of environment variables. (This environment is not to be confused with the Scheme environments that can be passed to
eval
.) Both the name and value of an environment variable are strings. The procedureget-environment-variable
returns the value of the environment variablename
, or#f
if the environment variable is not found. (This uses thejava.lang.System:getenv
method.) It is an error to mutate the resulting string.(get-environment-variable "PATH") ⇒ "/usr/local/bin:/usr/bin:/bin"
Procedure: get-environment-variables
Returns the names and values of all the environment variables as an alist, where the car of each entry is the name of an environment variable, and the cdr is its value, both as strings. It is an error to mutate any of the strings or the alist itself.
(get-environment-variables) ⇒ (("USER" . "root") ("HOME" . "/"))