command-line - retrieve the program's command line
(import (rnrs)) ;R6RS
(import (rnrs programs)) ;R6RS
(import (scheme process-context)) ;R7RS
Returns the command line passed to the process as a list of strings.
The first element is an implementation-specific name for the running
top-level program. The remaining elements are command-line arguments
according to the operating system's conventions.
It is an error to mutate any of these strings.
Larceny uses "larceny" as the first element of the list.
Returns a single value which is a list of strings.
;; When invoked from the shell:
$ ./cmd.sps Hello World
("./cmd.sps" "Hello" "World")
This procedure is used in programs that are invoked from the command
line or that can be customized with a command line argument. Programs
meant to be invoked from the shell can use a command line parser like
The first string in the list is unreliable. Many implementations use
the name of the program file or copy the string received from the
operating system, but there exist situations where that fails, such as
is used with a NULL or zero-length argv.
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
The wrong number of arguments was passed.
The assertions described above are errors.
Implementations may signal an error, extend the procedure's
domain of definition to include such arguments,
or fail catastrophically.
This procedure is new to R6RS and to R7RS. Early Scheme systems running on
MacLISP had access to
that returned the job command line, or the equivalent depending on
which system it was running on.
This page is part of the
It includes materials from the RnRS documents.
More information can be found at
Markup created by unroff 1.0sc, March 04, 2023.