Next Previous Up Top Contents Index

9 The Operating-System Module

9.2 Manipulating environment information

The Operating-System module contains a number of interfaces for examining and specifying information about the operating system environment of the host machine. As well as providing constants that you can use in your code, you can examine and set the value of any environment variable in the system.

The following constants contain machine-specific information.

$architecture-little-endian

Constant

$machine-name

Constant

$os-name

Constant

$os-variant

Constant

$os-version

Constant

$platform-name

Constant

These constants contain information about the hardware and software resident on the host machine. The constants let you programmatically check the current system conditions before executing a piece of code.
The constant $architecture-little-endian is a boolean value that is true if the processor architecture is little-endian and false if it is big-endian. (A processor is little-endian if the rightmost bit in a word is the least-significant bit.) For processors implementing the Intel x86 architecture this value is #t.
The constant $machine-name specifies the hardware installed in the machine. The constant $os-name specifies the operating system that is running.
The constant $os-variant is a symbol value distinguishing between variants of the operating system identified by $os-name, where relevant; otherwise it has the same value as $os-name. On Windows, the possible values are #"win3.1", #"win95", #"win98", and #"winnt".
The constant $os-version is a string value that identifies the version of the operating system. For Windows NT, a typical value would be "4.0.1381 Service Pack 3". For Windows 95, a typical value would be "4.0.1212 B".
The $platform-name constant is an amalgam of the information contained in $machine-name and $os-name, to enable you to conveniently conditionalize your code based on both values.

The following two functions let you manipulate the values of any environment variables in the system.

environment-variable

Function

environment-variable-setter

Function

environment-variable name => value

environment-variable-setter new-value name => new-value

The function environment-variable returns the current value of any environment variable. The function environment-variable-setter lets you specify the value of any environment variable. All arguments and returns values in these functions are instances of <byte-string>.If the environment variable passed to environment-variable does not exist, it creates it. For environment-variable-setter, if new-value is #f, then the environment variable specified is undefined, if undefining environment variables is supported.

The following functions access information about the user logged on to the current machine, where available.

login-name

Function

login-name () => name-or-false 

Returns as an instance of <string> the name of the user logged on to the current machine, or #f if unavailable.
login-group

Function

login-group () => group-or-false 

Returns as an instance of <string> the group (for example NT domain, or Windows Workgroup) of which the user logged on to the current machine is a member, or #f if the group unavailable.
owner-name

Function

owner-name () => name-or-false 

Returns as an instance of <string> the name of the user who owns the current machine (that is, the name entered when the machine was registered), or #f if the name unavailable.
owner-organization

Function

owner-organization () => organization-or-false 

Returns as an instance of <string> the organization to which the user who owns the current machine belongs, or #f if the name unavailable.

System and I/O Reference - 31 MAR 2000

Next Previous Up Top Contents Index