HEADS UP: getenv() and family API change

Sean C. Farley scf at FreeBSD.org
Tue Jul 3 23:36:01 UTC 2007


As announced on -arch[1], I will be committing the changes to getenv(3)
and family (setenv(), putenv and unsetenv()) shortly.  A bit of details
on the change can be found on -ports[2].

Changes in moving to POSIX from historic BSD API:
   a. unsetenv returns an int.
   b. putenv takes a char * instead of const char *.
   c. putenv no longer makes a copy of the input string.
   d. errno is set appropriately for POSIX.  Exceptions involve bad
      environ variable and internal initialization code.  These both set
      errno to EFAULT.

Let me know if you run across any problems.

Sean
   1. http://lists.freebsd.org/pipermail/freebsd-arch/2007-June/006554.html
   2. http://lists.freebsd.org/pipermail/freebsd-ports/2007-May/041577.html
-- 
scf at FreeBSD.org


More information about the freebsd-current mailing list