On Tue, Oct 13, 2009 at 8:32 AM, Guenter Knauf <fuankg@apache.org> wrote:
Hi,
I was just looking into the setenv / unsetenv stuff in APR, and found
that we assume that unsetenv doesnt have a return value on all
platforms. I have searched a bit, and found these:
http://linux.die.net/man/3/setenv
http://www.manpagez.com/man/3/unsetenv/
from that it seems that there are newer versions of unsetenv() out which
return an int and set errno. I've tested this on Linux 2.6.27.29, and I
dont get an error back when I try to unsetenv a non-existent var ...
now I would like to get some info about how MacOSX and *BSD platforms
behave - see attached sample for a quick test. Form the docu at least
MacOSX should return EINVAL for a non-existent var ...

thanks, GŁn.


MacOS X 10.5.8 (MacBook Pro):

Osiris JL: gcc -o testenv -Wall testenv.c
Osiris JL: ./testenv
setenv(FOOBAR_EMPTY) rv = 0, errno = 0
unsetenv(FOOBAR_EMPTY) rv = 0, errno = 0
unsetenv(FOOBAR_NONEXISTING) rv = 0, errno = 0
Osiris JL:


Solaris 10 (SPARC )

Black JL: gcc -o testenv testenv.c -Wall
Black JL: ./testenv
setenv(FOOBAR_EMPTY) rv = 0, errno = 0
unsetenv(FOOBAR_EMPTY) rv = 0, errno = 0
unsetenv(FOOBAR_NONEXISTING) rv = 0, errno = 0
Black JL:




--
Jonathan Leffler <jonathan.leffler@gmail.com> †#include <disclaimer.h>
Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be amused."