summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-01-16 13:00:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-01-16 13:00:21 +0000
commit0a5ce153d6f949c0107c4acc3c6572878d3aa2a3 (patch)
tree9f9ff956a45c228deefa7a3b50f3dadc48f44900 /lib
parent72e0b10567bc33be27a7c609f885cf43c95ec845 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@20 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/Env.rb28
-rw-r--r--lib/tempfile.rb2
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/Env.rb b/lib/Env.rb
new file mode 100644
index 0000000000..e52501f801
--- /dev/null
+++ b/lib/Env.rb
@@ -0,0 +1,28 @@
+# Env.rb -- imports environment variables as global variables
+#
+# Usage:
+#
+# p $USER
+# $USER = "matz"
+# p ENV["USER"]
+
+for k,v in ENV
+ next unless /^[a-zA-Z][_a-zA-Z0-9]*/ =~ k
+ eval <<EOS
+ $#{k} = %q!#{v}!
+ trace_var "$#{k}", proc{|v|
+ ENV[%q!#{k}!] = v;
+ $#{k} = %q!#{v}!
+ if v == nil
+ untrace_var "$#{k}"
+ end
+ }
+EOS
+end
+
+p $TERM
+$TERM = nil
+p $TERM
+p ENV["TERM"]
+$TERM = "foo"
+p ENV["TERM"]
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 90d3a65c77..a6ffaa55fe 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -1,7 +1,7 @@
#
# $Id$
# Copyright (C) 1998 akira yamada. All rights reserved.
-# This file can be distributed under the terms the Ruby.
+# This file can be distributed under the terms of the Ruby.
# The class for temporary files.
# o creates a temporary file, which name is "basename.pid.n" with mode "w+".