1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs help.markup help.syntax io.streams.string sequences strings ;
10 { $description "Returns a sequence of key/value pairs from the operating system." }
11 { $notes "In most cases, use " { $link os-envs } " instead." } ;
16 { $description "Low-level word for replacing the current set of environment variables." }
17 { $notes "In most cases, use " { $link set-os-envs } " instead." } ;
21 { $values { "key" string } { "value" string } }
22 { $description "Looks up the value of a shell environment variable." }
24 "This is an operating system-specific feature. On Unix, you can do:"
26 "USING: environment io ;"
27 "\"USER\" os-env print"
33 { $values { "key" string } { "quot" { $quotation "( old -- new )" } } }
34 { $description "Applies a quotation to change the value stored in an environment variable." }
36 "This is an operating system-specific feature. On Unix, you can do:"
38 "USING: environment io ;"
39 "\"USER\" os-env print"
40 "\"USER\" [ \"-doe\" append ] change-os-env"
41 "\"USER\" os-env print"
45 { $side-effects "key" } ;
48 { $values { "assoc" "an association mapping strings to strings" } }
49 { $description "Outputs the current set of environment variables." }
51 "Names and values of environment variables are operating system-specific."
55 { $values { "assoc" "an association mapping strings to strings" } }
56 { $description "Replaces the current set of environment variables." }
58 "Names and values of environment variables are operating system-specific. Windows NT allows values up to 32766 characters in length."
62 { $values { "value" string } { "key" string } }
63 { $description "Set an environment variable." }
65 "Names and values of environment variables are operating system-specific."
69 { $values { "key" string } }
70 { $description "Unset an environment variable." }
72 "Names and values of environment variables are operating system-specific."
75 { os-env os-envs set-os-env unset-os-env set-os-envs change-os-env } related-words
78 ARTICLE: "environment" "Environment variables"
79 "The " { $vocab-link "environment" } " vocabulary interfaces to the platform-dependent mechanism for setting environment variables." $nl
80 "Reading environment variables:"
85 "Writing environment variables:"