summaryrefslogtreecommitdiff
path: root/lisp/env.el
diff options
context:
space:
mode:
authorNoah Friedman <friedman@splode.com>1993-03-28 07:13:09 +0000
committerNoah Friedman <friedman@splode.com>1993-03-28 07:13:09 +0000
commit1bbda2d6e09abccab133398e4623ae1a8a08d8fc (patch)
treefbf74d5ba4418210258fb5dc71876559b8cab908 /lisp/env.el
parent1a2f456b73bab4a711a51c8f84abf1d9f63a3b90 (diff)
downloademacs-1bbda2d6e09abccab133398e4623ae1a8a08d8fc.tar.gz
renamed to env.el; changed setenv to putenv.
Diffstat (limited to 'lisp/env.el')
-rw-r--r--lisp/env.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/lisp/env.el b/lisp/env.el
index 3445d1c060e..145c164ddde 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -1,4 +1,4 @@
-;;; setenv.el --- functions to manipulate environment variables.
+;;; env.el --- functions to manipulate environment variables.
;;; Copyright Free Software Foundation 1991
@@ -31,24 +31,30 @@
;;; Code:
;;;###autoload
-(defun setenv (variable value)
+(defun putenv (variable &optional value)
"Set the value of the environment variable named VARIABLE to VALUE.
-VARIABLE and VALUE should both be strings.
+VARIABLE should be a string. VALUE is optional; if not provided or is
+`nil', the environment variable VARIABLE will be removed.
This function works by modifying `process-environment'."
(interactive "sSet environment variable: \nsSet %s to value: ")
(if (string-match "=" variable)
- (error "Environment variable name contains `='")
+ (error "Environment variable name `%s' contains `='" variable)
(let ((pattern (concat "\\`" (regexp-quote (concat variable "="))))
(scan process-environment))
(while scan
(cond
((string-match pattern (car scan))
- (setcar scan (concat variable "=" value))
+ (if (eq nil value)
+ (setq process-environment (delq (car scan) process-environment))
+ (setcar scan (concat variable "=" value)))
(setq scan nil))
((null (setq scan (cdr scan)))
(setq process-environment
(cons (concat variable "=" value) process-environment))))))))
-(provide 'setenv)
+;; Provide backward-contemptibility.
+(fset 'setenv 'putenv)
-;;; setenv.el ends here
+(provide 'env)
+
+;;; env.el ends here