Script Library: 1240 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 
View scriptLicenseDownload documentation as: HTML or editable
Download scriptHistoryOther scripts by: peterwood

Documentation for: environ.r


environ.r is a simple script that decodes the Rebol version number 
(in system/version) to provide information that should be of use 
in multi-platform scripts.

The script makes an object environ which contains five functions:


os? returns a string indicating the operating system for operating 
systems commonly targeted for multi-platform scripts. It returns 
"other" for less commonly targeted platforms.
  usage: if environ/os? = "mac" [call "chmod 775 my-cgi.r"]

nix? returns true for unix-based operating systems.
  usage: if environ/nix? [call "chmod 775 my-cgi.r"]

win32? returns true for windows 32 operating systems
  usage: if environ/win32? [my-win32-api-call]

win? returns true for windows 32 and CE operating systems
  usage: if environ/win? [call "copy %myimportantfile %../backup]

cpu? returns a string of the processor
  usage: if environ/cpu? = "x86" [refresh-rate: 10]


Note: False results will be returned if rebol is being run under 
an emulator such as Wine on Linux as the results are based upon decoding 
the version of Rebol that is running.