diff options
author | ache <ache@FreeBSD.org> | 2007-04-30 16:56:18 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2007-04-30 16:56:18 +0000 |
commit | d85104099ad40c33148426adb779741c366c2f19 (patch) | |
tree | 0f48274fab3bf61e5379abd241da2f704d7da652 /lib/libc/stdlib/getenv.3 | |
parent | b5d028a647a14c0c4d23e84788a75778dfd9a05e (diff) | |
download | FreeBSD-src-d85104099ad40c33148426adb779741c366c2f19.zip FreeBSD-src-d85104099ad40c33148426adb779741c366c2f19.tar.gz |
Make putenv() fully conforms to Open Group specs Issue 6
(also IEEE Std 1003.1-2001)
The specs explicitly says that altering passed string
should change the environment, i.e. putenv() directly puts its arg
into environment (unlike setenv() which just copies it there).
It means that putenv() can't be implemented via setenv()
(like we have before) at all. Putenv() value lives (allows modifying)
up to the next putenv() or setenv() call.
Diffstat (limited to 'lib/libc/stdlib/getenv.3')
-rw-r--r-- | lib/libc/stdlib/getenv.3 | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3 index 1882ba2..7445b47 100644 --- a/lib/libc/stdlib/getenv.3 +++ b/lib/libc/stdlib/getenv.3 @@ -88,11 +88,17 @@ to the given .Pp The .Fn putenv -function takes an argument of the form ``name=value'' and is -equivalent to: -.Bd -literal -offset indent -setenv(name, value, 1); -.Ed +function takes an argument of the form ``name=value'' and +puts it directly into the current environment. +If the variable +.Fa name +does not exist in the list, +it is inserted with the given +.Fa value . +If the variable +.Fa name +does exist, it is reset to the given +.Fa value . .Pp The .Fn unsetenv @@ -145,7 +151,8 @@ The function conforms to .St -isoC . The -.Fn setenv +.Fn setenv , +.Fn putenv and .Fn unsetenv functions conforms to |