summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-04-18 10:47:14 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-04-18 10:47:14 -0700
commite21f19001551eddbb8d27acea1327590ce124461 (patch)
tree20d20e1f3ed7deca262fcd0c2bd366af88715c81 /txr.1
parentc765b773e63b2099a050fef21b5e7f06296af2ec (diff)
downloadtxr-e21f19001551eddbb8d27acea1327590ce124461.tar.gz
txr-e21f19001551eddbb8d27acea1327590ce124461.tar.bz2
txr-e21f19001551eddbb8d27acea1327590ce124461.zip
Adding getenv, setenv and unsetenv.
* lib.c (setenv, unsetenv): Changed static functions to external. Moved them out of the #if !HAVE_TIMEGM block. * lib.h (setenv, unsetenv): Declared. * sysif.c (getenv_wrap, setenv_wrap, unsetenv_wrap): New functions. (sysif_init): Registered getenv, setenv and unsetenv. * txr.1: Documented getenv, setenv and unsetenv. * tl.vim, txr.vim: Regenerated.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.166
1 files changed, 66 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 8c4ccc07..d7c665e9 100644
--- a/txr.1
+++ b/txr.1
@@ -24106,6 +24106,11 @@ on the output (since the UTC zone by definition doesn't have daylight
savings time).
.SS* Environment Variables and Command Line
+
+Note that environment variable names, their values, and command line
+arguments are all regarded as being externally encoded in UTF-8. \*(TX performs
+the encoding and decoding automatically.
+
.coNP Special variables @ *args* and @ *args-full*
.desc
The
@@ -24160,6 +24165,67 @@ function constructs and returns an
hash. The hash is
populated with the environment variables, represented as key-value pairs.
+.coNP Functions @, getenv @, setenv and @ unsetenv
+.synb
+.mets (getenv << name )
+.mets (setenv < name < value <> [ overwrite-p ])
+.mets (unsetenv << name )
+.syne
+.desc
+These functions provide access to, as well as manipulation of, environment
+variables. Of these three,
+.code setenv
+and
+.code unsetenv
+might not be available on some platforms, or
+.code unsetenv
+might be be present in a simulated form which sets the variable
+.meta name
+to the empty string rather than deleting it.
+
+The
+.code getenv
+function searches the environment for the environment variable whose name
+is
+.metn name .
+If the variable is found, its value is returned. Otherwise
+.code nil
+is returned.
+
+The
+.code setenv
+function creates or modifies the environment variable indicated by
+.metn name .
+The
+.meta value
+string argument specifies the new value for the variable.
+
+If the
+.meta overwrite-p
+argument is specified, and is true,
+then the variable is overwritten if it already exists.
+If the argument is false, then the variable is not modified if it
+already exists. If the argument is not specified, it defaults
+to the value
+.metn t,
+effectively giving rise to a two-argument form of
+.code setenv
+which creates or overwrites environment variables.
+
+The
+.code setenv
+function unconditionally returns
+.meta value
+regardless of whether or not it overwrites an existing variable.
+
+The
+.code unsetenv
+function removes the enviornment variable
+specified by
+.metn name ,
+if it exists. On some platforms, it instead sets the environment variable
+to the empty string.
+
.SS* System Programming
.coNP Function @ errno
.synb