For Gauche 0.9.15Search (procedure/syntax/module):

Next: , Previous: , Up: Library modules - SRFIs   [Contents][Index]

11.44 srfi.193 - Command line

Module: srfi.193

This srfi clarifying how the command line arguments can be accessed via R7RS command-line, plus a few supporting APIs.

The following procedures are built-in. See Command-line arguments, for the details.

command-line          script-file
Function: command-name

[SRFI-193]{srfi.193} If the first element of command-line is an empty string, returns #f. Otherwise, returns the first element without directory name and obvious extension (.scm, .exe) stripped.

For example, if you run a Scheme script foo.scm as a program, this procedure returns foo. If you compile your script to an executable on Windows as the name /usr/local/bin/foo.exe, this procedure still returns foo. In general, if you are running a Scheme program as some sort of ’command’, this procedure returns its name. The exception is when you’re running a REPL, in which case this procedure returns #f.

This is useful for diagnostic messages, for example.

Function: command-args

[SRFI-193]{srfi.193} Returns the cdr of (command-line).

Function: script-directory

[SRFI-193]{srfi.193} Returns the directory part of (script-file), if it has a string path. It always ends with the directory separator. If (script-file) is #f, #f is returned.

This is useful, for example, to find an auxiliary files relative to the script location.


Next: , Previous: , Up: Library modules - SRFIs   [Contents][Index]


For Gauche 0.9.15Search (procedure/syntax/module):